How do I get info on an exception ?

Heiko Wundram heikowu at ceosg.de
Fri Jul 18 02:43:11 EDT 2003


> How do I get the "(11004, 'host not found')" part?
> More importantly, where is the answer documented that I should
> have looked?

Look at the traceback module from the Python standard library. If you
just wish to print the exception, do the following:

import traceback

try:
	nosuchobject
except:
	traceback.print_exc()

HTH!

Heiko.






More information about the Python-list mailing list