This module provides a standard interface to format and print stack traces of Python programs. It exactly mimics the behavior of the Python interpreter when it prints a stack trace. This is useful when you want to print stack traces under program control, e.g. in a ``wrapper'' around the interpreter.
The module uses traceback objects -- this is the object type
that is stored in the variables
The module defines the following functions:
None, all entries are printed.
None, all entries are extracted. A ``pre-processed'' stack trace entry is a quadruple (filename, line number, function name, line text) representing the information that is usually printed for a stack trace. The line text is a string with leading and trailing whitespace stripped; if the source is not available it is
print_tbin the following ways: (1) if traceback is not
None, it prints a header ``
Traceback (innermost last):''; (2) it prints the exception type and value after the stack trace; (3) if type is
SyntaxErrorand value has the appropriate format, it prints the line where the syntax error occurred with a caret indication the approximate position of the error.