AttributeError with MySQLdb and Python 2.2.2.

Jerry Seutter jerry.seutter at
Fri Mar 7 22:54:08 CET 2003


I'm just trying to get up and running with MySQLdb-0.9.2, Python-2.2.2 and
mod_python-2.7.8 (Apache stuff).

I get random errors that look like:

> Exception exceptions.AttributeError: "'NoneType' object has no
> 'close'" in <bound method Cursor.__del__ of <MySQLdb.cursors.Cursor
> instance at 0x84a4efc>> ignored

This is what I have been able to find out (as far as I can understand it):

This is a documented bug when using mod_python 2.7.8 with Python 2.2
(though not older versions).  It is apparently related to the garbage
collection implementation in Python 2.2.  It is not serious but can be
eliminated by ensuring that all instances of BaseCursor are closed
before being cleaned up.

As far as I can tell, I don't touch BaseCursors.

Running Python 2.1, the error message goes away.  This was suggested in one
of the comments on the MySQLdb homepage (

Anyways.  Now I want to make the error disappear, and I'm not quite sure
what needs to be fixed.  Is it a problem with my code, MySQLdb, or with
newer versions of Python?  Has anyone else experienced this?  Has anyone 
figured out how to fix it?

Jerry Seutter

More information about the Python-list mailing list