rodmc wrote:
> 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
>

Use the traceback module (See
http://docs.python.org/lib/module-traceback.html for info on it.)

import traceback

try:
    db = MySQLdb.connect(host=DBSERVERIP, user="user",
passwd="password", db="nuke")
except:
    print "A database connection error has occurred"
    traceback.print_exc()
    return False
else:
    pass

#The rest of the program


It's generally very difficult to figure out what's going wrong without
the traceback in front of you.

Also, try an empty string (i.e. "") as your hostname, it's shorthand
for 'localhost'.


Hope this helps,
~Simon

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to