How to use sys.exc_info()???
Alexis Lê-Quôc
alq666 at yahoo.com
Wed Oct 18 15:33:36 EDT 2000
I believe it's in sys.exc_info()[1]. If you 'dir' the object, you can see
that it has 'args' and 'strerror' among its members. I believe both are the
ones you're interested in.
Alexis Le-Quoc
> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Roy Smith
> Sent: Wednesday, October 18, 2000 15:10
> To: python-list at python.org
> Subject: How to use sys.exc_info()???
>
>
> I'm stuped with how sys.exc_info() is supposed to work. If I do:
>
> open ('xxx')
>
> I get:
>
> Traceback (innermost last):
> File "<stdin>", line 1, in ?
> IOError: [Errno 2] No such file or directory: 'xxx'
>
> Which is what I expect. But when I do:
>
> try:
> open ('xxx')
> except:
> foo = sys.exc_info()
>
> What I end up with in foo is
>
> (<class exceptions.IOError at 80a7e20>, <exceptions.IOError
> instance at 80c82d0>, <traceback object at 80c92c8>)
>
> What I don't understand is how to go from the 3-tuple I get back from
> exc_info() to the string "No such file or directory"?
>
> --
> http://www.python.org/mailman/listinfo/python-list
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
More information about the Python-list
mailing list