[Tutor] Mysqldb.py:::Cursor has no 'query' attribute?
Israel Evans
israel@lith.com
Fri, 22 Mar 2002 09:36:49 -0800
I've just started working with MySQL, and the Mysqldb module for python and,
as usual, I've run into some problems...
after I type the following code in the the Python shell...
>>> import CompatMysqldb
>>> conn = CompatMysqldb.mysqldb('test@localhost israel
SuperSecretPassword1')
>>> cursor = CompatMysqldb.Cursor(conn)
>>> cursor.execute('select version(), current_date')
... I get the error:
Traceback (most recent call last):
File "<pyshell#4>", line 1, in ?
cursor.execute('select version(), current_date')
File "C:\proj\Python22\Lib\site-packages\CompatMysqldb.py", line 243, in
execute
self.__conn.query(op)
File "C:\proj\Python22\Lib\site-packages\CompatMysqldb.py", line 123, in
__getattr__
return getattr(self.__curs, key)
AttributeError: Cursor instance has no attribute 'query'
Anybody know why and what I can do about it?
line 243 calls this:
self.__conn.query(op)
which looks and the self.__conn of the cursor which looks at the conn passed
into it at creation time which is supposed to reflect the (self.__curs, key)
of the instance of the Connection class I created with the conn = blah
blah... command which happens to be self.__curs = Cursor(self.__conn).
I feel like it's running in circles!
Confused'ly yours
~Israel~