Strange exceptions in MySQLdb

Fredrik Lundh fredrik at
Thu Oct 14 16:50:09 CEST 2004

Hector Villafuerte wrote:

> I have been using Python 2.3.4 with MySQL 4.0.16-max-nt (through
> MySQLdb) for months. Today this messages showed up:
> Exception exceptions.AttributeError: "'NoneType' object has no
> attribute 'close'" in <bound method Cursor.__del__ of
> <MySQLdb.cursors.Cursor instance at 0x0099C148>> ignored

this means that the Cursor destructor (the __del__ method) attempts to
call some global object during cleanup, but that object has already been
cleaned away.

for some more information on the cleanup procedure, see:

(this should be mentioned in the reference documentation somewhere,
but I only got through to for long enough to dig up that link)

it's most likely a bug in the MySQLdb driver (objects using destructors
*should* keep references to any object needed by the destructor).  to
see if it's really harmless, you may want to check the source code: look
for "close" method calls in the Cursor destructor.


More information about the Python-list mailing list