AttributeError with MySQLdb and Python 2.2.2.

Jerry Seutter jerry.seutter at pason.com
Fri Mar 7 16:54:08 EST 2003


Hello,

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
attribute
> '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 (http://sourceforge.net/tracker/index.php?func=detail&aid=599192&group_id=22307&atid=374932)

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?

Confused,
Jerry Seutter






More information about the Python-list mailing list