As part of a larger debugging effort, I've run into the following bug using mysqldb:
File "x.py" line x, in method
cursor.close()
File "y.py" line 100, in close
while self.nextset(): pass
File "z.py" line 137, in nextset
self._waring_check()
...
Exception _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now") in <bound method Cursor.__del__ of <MySQLdb.cursor.Cursor object at 0x000002373198>> ignored
The relevant pieces of my code are as follows:
connection = mysqldb.connect('localhost', 'root', 'password', 'db')
cursor = connection.cursor()
file = open(filename, 'r')
sql = s = " ".join(file.readlines)
cursor.execute(sql)
cursor.close()
...
The error is thrown on the cursor.close() line before I get into anything else, which makes no sense to me... Anybody know what I'm doing wrong? There's only a single thread used in all the code.