PyDocs

Nav

Python Runtime Services

format_exception

traceback

function (source)
  • format_exception(exc, /, [value, tb, ]limit=None, chain=True)
Format a stack trace and the exception information.

The arguments have the same meaning as the corresponding arguments
to print_exception().  The return value is a list of strings, each
ending in a newline and some containing internal newlines.  When
these lines are concatenated and printed, exactly the same text is
printed as does print_exception().
Changed in 3.5, 3.10
  • 3.5: The etype argument is ignored and inferred from the type of value.
  • 3.10: This function’s behavior and signature were modified to match print_exception().
0 Examples
No examples for traceback/format_exception.
See Also
No see-alsos for traceback/format_exception
0 Notes
No notes for format_exception