MySQLdb Question

David A McInnis david at dataovation.com
Mon Nov 5 11:45:04 EST 2001


Great.  That was it.

Thanks,

David

-----Original Message-----
From: Skip Montanaro [mailto:montanaro at tttech.com]
Sent: Monday, November 05, 2001 8:22 AM
To: david at dataovation.com
Cc: Python
Subject: Re: MySQLdb Question



    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,
			  host=config.host, db = "prweb",
			  cursorclass=MySQLdb.cursors.DictCursor)

--
Skip Montanaro (skip at pobox.com)





More information about the Python-list mailing list