Python - pymysql.err.Error: Already closed

Odpověď na dotaz zpravidla není nejrychlejší, ale pokud už byl dotaz schválen, tak se Vám dostane relevantní odpovědi v nejbližší možné době.
Autor Biodynamic
Publikováno 19.07.2021
Kategorie programovani
Stav Nevyřešeno
Dobrý den,

po updatu verze Python se při práci s pymysql často objevuje chyba pymysql.err.InterfaceError: (0, '')

Použivám v celém skriptu volání jednoho připojení con takto:
con = mysql.connect(**config)
a pak už všude volám jen
with con:

Celá chyba:

Traceback (most recent call last):
File "/var/script45.py", line 387, in fillerLoop
cur.execute(sql)
File "/usr/local/lib/python3.8/dist-packages/pymysql/cursors.py", line 148, in execute
result = self._query(query)
File "/usr/local/lib/python3.8/dist-packages/pymysql/cursors.py", line 310, in _query
conn.query(q)
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 547, in query
self._execute_command(COMMAND.COM_QUERY, sql)
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 793, in _execute_command
raise err.InterfaceError(0, "")
pymysql.err.InterfaceError: (0, '')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/var/script45.py", line 391, in fillerLoop
print("-----------")
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 360, in __exit__
self.close()
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 404, in close
raise err.Error("Already closed")
pymysql.err.Error: Already closed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/var/script45.py", line 423, in
object.fillerLoop()
File "/var/script45.py", line 408, in fillerLoop
sys.exit("Program ukoncen!")
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 360, in __exit__
self.close()
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 404, in close
raise err.Error("Already closed")


Díky


The English language is translated by machine - the translator can modify eg cited codes = it is better to use codes from the Czech original.

Python - pymysql.err.Error: Already closed

Hi,
pymysql.err.InterfaceError: (0, '') often occurs when working with pymysql after updating Python.

I use the same con connection call in the whole script as follows:
con = mysql.connect(**config)
and then I just call everywhere
with con:

The whole error:

Traceback (most recent call last):
File "/var/script45.py", line 387, in fillerLoop
cur.execute(sql)
File "/usr/local/lib/python3.8/dist-packages/pymysql/cursors.py", line 148, in execute
result = self._query(query)
File "/usr/local/lib/python3.8/dist-packages/pymysql/cursors.py", line 310, in _query
conn.query(q)
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 547, in query
self._execute_command(COMMAND.COM_QUERY, sql)
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 793, in _execute_command
raise err.InterfaceError(0, "")
pymysql.err.InterfaceError: (0, '')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/var/script45.py", line 391, in fillerLoop
print("-----------")
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 360, in __exit__
self.close()
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 404, in close
raise err.Error("Already closed")
pymysql.err.Error: Already closed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/var/script45.py", line 423, in
object.fillerLoop()
File "/var/script45.py", line 408, in fillerLoop
sys.exit("Program ukoncen!")
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 360, in __exit__
self.close()
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 404, in close
raise err.Error("Already closed")


Thanks

Odpovídáte na:

Dobrý den, po updatu verze Python se při práci s pymysql často objevuje chyba <strong>pymysql.err.InterfaceError: (0, '')</strong> Použivám v celém…

Odpověď NESMÍ obsahovat HTTP odkazy, odstraňují se veřejné IP a emaily. Systém automaticky zamítá duplicitní odpovědi.

Tento web používá k poskytování služeb, personalizaci reklam a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tím souhlasíte. Další informace