Getting error condition from MySQLdb

Derek Fountain nomail at hursley.ibm.com
Mon Nov 3 21:28:39 EST 2003


Andy Todd wrote:

> Derek Fountain wrote:
> 
>> I was trying to use MySQLdb to connect to a database. All is OK, except I
>> can't figure out how to get the details of an error. Suppose I try to
>> connect to a non existant server, or with the wrong password - how do I
>> get a meaningful error message which I can present to my user?
>> 
> 
> In Python whenever an error occurs an exception is raised. I'd suggest a
>   quick read of the section of the tutorial that explains this;
> 
> http://www.python.org/doc/current/tut/node10.html
<snip!>

Thanks, this makes things a bit clearer. But it also raises another
question, for which I'll start a new thread.





More information about the Python-list mailing list