Python Forum
how to connect mysql from txt 1 line goes good but not all lines in text
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to connect mysql from txt 1 line goes good but not all lines in text
#3
hii i dont understand what you meant brother and is it normal i cant msg you?
any good good site for tut on python?
and i have now made small changes to my dbs connect file can you look at it for me and in small explain to me that if the program connects or not how continue to last dbs in opend file and not stop after check one

import MySQLdb
import MySQLdb._exceptions
import sys, os, requests


with open("datafile.txt", "r") as lijst:
            for line in lijst:
                lijst.readline
                connection = eval('MySQLdb.connect({})'.format(lijst.readline().strip()))
                print(connection)
               
Error:
C:\Users\Gebruiker\Downloads\V1>python3 *****.py <_mysql.connection open to 'localhost' at **********> Traceback (most recent call last): File "C:\Users\Gebruiker\Downloads\V1\****.py", line 8, in <module> connection = eval('MySQLdb.connect({})'.format(lijst.readline().strip())) File "<string>", line 1, in <module> File "C:\Users\Gebruiker\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\MySQLdb\__init__.py", line 130, in Connect return Connection(*args, **kwargs) File "C:\Users\Gebruiker\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\MySQLdb\connections.py", line 185, in __init__ super().__init__(*args, **kwargs2) MySQLdb._exceptions.OperationalError: (2002, "Can't connect to MySQL server on 'localhost' (10060)")
Reply


Messages In This Thread
RE: how to connect mysql from txt 1 line goes good but not all lines in text - by kingceasarr - Mar-24-2021, 01:41 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Line graph with two superimposed lines sawtooth500 4 386 Apr-02-2024, 08:56 PM
Last Post: sawtooth500
  Mysql and mysql.connector error lostintime 2 734 Oct-03-2023, 10:25 PM
Last Post: lostintime
  Python Serial: How to read the complete line to insert to MySQL? sylar 1 857 Mar-21-2023, 10:06 PM
Last Post: deanhystad
  Graphic line plot with matplotlib, text file in pytho khadija 2 1,426 Aug-15-2022, 12:00 PM
Last Post: khadija
  Editing text between two string from different lines Paqqno 1 1,340 Apr-06-2022, 10:34 PM
Last Post: BashBedlam
  Skipping line in text without Restarting Loop IdMineThat 4 1,532 Apr-05-2022, 04:23 AM
Last Post: deanhystad
  Extracting Specific Lines from text file based on content. jokerfmj 8 3,113 Mar-28-2022, 03:38 PM
Last Post: snippsat
  Find and delete above a certain line in text file cubangt 12 3,569 Mar-18-2022, 07:49 PM
Last Post: snippsat
  CSV to Text File and write a line in newline atomxkai 4 2,761 Feb-15-2022, 08:06 PM
Last Post: atomxkai
  Mysql error message: Lost connection to MySQL server during query tomtom 6 16,293 Feb-09-2022, 09:55 AM
Last Post: ibreeden

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020