Standard Module traceback

traceback 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 sys.exc_traceback and sys.last_traceback. The module defines the following functions:
\begin{funcdesc}{print_tb}{traceback\optional{\, limit}}
Print up to \var{limit}...
...f
\var{limit} is omitted or \code{None}, all entries are printed.
\end{funcdesc}

\begin{funcdesc}{extract_tb}{traceback\optional{\, limit}}
Return a list of up t...
...space stripped; if the source is not available it is
\code{None}.
\end{funcdesc}

\begin{funcdesc}{print_exception}{type\, value\, traceback\optional{\, limit}}
P...
...ed with a
caret indication the approximate position of the error.
\end{funcdesc}

\begin{funcdesc}{print_exc}{\optional{limit}}
This is a shorthand for \code{prin...
...,}
\code{sys.exc_value,} \code{sys.exc_traceback,} \code{limit)}.
\end{funcdesc}

\begin{funcdesc}{print_last}{\optional{limit}}
This is a shorthand for \code{pri...
...
\code{sys.last_value,} \code{sys.last_traceback,} \code{limit)}.
\end{funcdesc}