Ah, that's an easy one, though I agree that the docs for this aren't
where you have probably been looking for them. The module sys defines
three variables: exc_type, exc_value and exc_traceback, which are set
to the current exception when an except clause is entered.
Note the distinction with the three similar variables last_type, ...
which are only set when the exception isn't handled and the
interpreter prints a stack trace. (This done so you can then import
the debugger and use it for post-mortem browsing. Also see the -i
option to the interpreter.)
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>