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 out how to use the dict cursor class instead of the default one. many thanks.<br>
<br><code><br>import MySQLdb<br>import sys<br># connect to the MySQL server<br>try:<br> conn = MySQLdb.connect(host="localhost<div id="1g33" class="ArwC7c ckChnd">",read_default_file='~/.my.cnf',db='test',cursorclass=MySQLdb.cursors.DictCursor)<br>
cur = conn.cursor()<br> print conn<br>except MySQLdb.Error, e:<br> print "Error %d: %s" % (e.args[0], e.args[1])<br> sys.exit (1)<br></code><br><br>Traceback (most recent call last):<br> File "/Users/.....src/db/test.py", line 7, in ?<br>
conn = MySQLdb.connect(host="localhost",read_default_file='~/.my.cnf',db='te<br>st',cursorclass=MySQLdb.cursors.DictCursor)<br>AttributeError: 'module' object has no attribute 'cursors'</div>