MySQLdb Question

Skip Montanaro montanaro at
Mon Nov 5 17:21:53 CET 2001

    David> Can anyone tell me why I need to connect twice in order to set
    David> cursorclass=MySQLdb.cursors.DictCursor?

    David> If I try to include this argument the first time, I get an error.
    David> The only way I can get it to work without the error is to
    David> recreate the connection object a second time like this.

It works for me.  Is it perhaps because you didn't import
MySQLdb.cursors in your code before creating the connection (and that
the first connection you created did that import for you)?  Try this:

    import MySQLdb, MySQLdb.cursors
    db1 = MySQLdb.connect(user = config.user, passwd=config.passwd,, db = "prweb",

Skip Montanaro (skip at

More information about the Python-list mailing list