[Tutor] Handling MySQLdb exceptions

Joshua Simpson std3rr at gmail.com
Wed Dec 19 19:21:27 CET 2007

On Dec 19, 2007 10:14 AM, Paul Schewietzek <tetsuo2k6 at web.de> wrote:

> Is there any way to handle this exception? As you can see, I already
> tried it with _mysql_exceptions.OperationalError (the lines that are
> commented out), but _mysql_exceptions is not defined to Python....
"OperationalError" is contained in the MySQLdb module and thus namespace, so
you'll have to reference it like so:

except MySQLdb.OperationalError:

"Insert pseudo-insightful quote here." - Some Guy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071219/1dfb7a0a/attachment.htm 

More information about the Tutor mailing list