I have been trying to get the DictCursor working with mysqldb module but
can't seem to. I have pasted the basic connection code and the traceback
from pydev. The connection does open with the default cursor class. can't
figure this one out. many thanks.

<code>
import MySQLdb
import sys
# connect to the MySQL server
try:
    conn =
MySQLdb.connect(host="localhost",read_default_file='~/.my.cnf',db='test',cursorclass=MySQLdb.cursors.DictCursor)
    cur = conn.cursor()
    print conn
except MySQLdb.Error, e:
    print "Error %d: %s" % (e.args[0], e.args[1])
    sys.exit (1)
</code>

Traceback (most recent call last):
  File "/Users/.....src/db/test.py", line 7, in ?
    conn =
MySQLdb.connect(host="localhost",read_default_file='~/.my.cnf',db='te
st',cursorclass=MySQLdb.cursors.DictCursor)
AttributeError: 'module' object has no attribute 'cursors'
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to