How do I catch ExpatError exception?
Shuaib
aries.shuaib at gmail.com
Wed Aug 16 21:06:34 EDT 2006
Steve Holden wrote:
> import xml.parsers.expat
Thanks, that worked.
>
> def r():
> return 1/0
>
> try:
> print r()
> except:
> import sys
> t, v, tb = sys.exc_info()
>
> print "exception on line", tb.tb_lineno
How do I get the helpful text that is thrown with the exception? Like
if the exception is " IOError: [Errno 2] No such file or directory:
'out.xml' "
How do I get the the text after IOError: ?
Thanks again.
More information about the Python-list
mailing list