Help req: Problems with MySQLdb

rodmc userprogoogle-139 at yahoo.co.uk
Thu Jun 22 11:50:04 CEST 2006


Hi,

Thanks for your email. Well I am kind of new to exceptions in Python,
but here is the code used below, as you can see it is somewhat basic.
Is there a way to display more information about the exception?

Best,

rod



try:  #Exception handler for database queries
            db = MySQLdb.connect(host=DBSERVERIP, user="user",
passwd="password", db="nuke")
 except:
            print "A database connection error has occurred"
            return False
else:
    #The rest of the program

Sybren Stuvel wrote:
> rodmc enlightened us with:
> > --- it refuses to connect on the above line and the exception is
> > caught and a message displayed.
>
> So.... why do you think this exception and the error message contain
> no useful information at all?
>
> Sybren
> --
> The problem with the world is stupidity. Not saying there should be a
> capital punishment for stupidity, but why don't we just take the
> safety labels off of everything and let the problem solve itself?
>                                              Frank Zappa




More information about the Python-list mailing list