PyDocs

Nav

Python Runtime Services

print_exception

traceback

function (source)
  • print_exception(exc, /, [value, tb, ]limit=None, file=None, chain=True)
Print exception up to 'limit' stack trace entries from 'tb' to 'file'.

This differs from print_tb() in the following ways: (1) if
traceback is not None, it prints a header "Traceback (most recent
call last):"; (2) it prints the exception type and value after the
stack trace; (3) if type is SyntaxError and value has the
appropriate format, it prints the line where the syntax error
occurred with a caret on the next line indicating the approximate
position of the error.
Changed in 3.5, 3.10
  • 3.5: The etype argument is ignored and inferred from the type of value.
  • 3.10: The etype parameter has been renamed to exc and is now positional-only.
0 Examples
No examples for traceback/print_exception.
See Also
No see-alsos for traceback/print_exception
0 Notes
No notes for print_exception