sys.last_type
last_type
These three variables are not always defined; they are set when an
exception is not handled and the interpreter prints an error message
and a stack traceback. Their intended use is to allow an interactive
user to import a debugger module and engage in post-mortem debugging
without having to re-execute the command that caused the
error. (Typical use is “import pdb; pdb.pm()” to enter the post-mortem
debugger; see the The Python Debugger,
chapter for more
information.)
The meaning of the variables is the same as that of the return values
from sys.exc_info. (Since there is only one interactive thread,
thread-safety is not a concern for these variables, unlike for
exc_type etc.)