Freeload - 2008-01-04

Just wanted to let you guys know how i solved this!:

In the file MySQLdb/connections.py add this at the top:

from threading import BoundedSemaphore

also in the function definition Connection.init() you add:

self.sem = BoundedSemaphore(1)

In the file MySQLdb/Cursor.py
in the function definition BaseCursor.init (about line 43)
after self.connection = proxy(connection)
add this:

self.connection.sem.acquire()

And in the function definition of BaseCursor.close
just before self.connection = None
just add this:

self.connection.sem.release()

This ensures that the cursor has been closed before opening a new one, halting the execution of the script otherwise until it does.