See the title of this question. I want to play with the exception raised in the last command. _
didn't help me. Is there anything like that?
views:
115answers:
1
+4
A:
Do this:
import sys
sys.exc_info()
It will give you information about the exception. It's a tuple containing the exception type, the exception instance and a traceback object.
Lennart Regebro
2009-07-03 06:56:37
Thanks, also `sys.last_value` works. :)
Achimnol
2009-07-03 07:36:45
sys.last_value will not work in 3.0, sys.exc_info() will work on 3.0 and 2.x
Anurag Uniyal
2009-07-03 07:52:58