traceback.print_exception(etype, value, tb, limit=None, file=None, chain=True)
Print exception information and stack trace entries from traceback object tb to file. This differs from print_tb() in the following ways:
- if tb is not
None, it prints a headerTraceback (most recent call last): - it prints the exception etype and value after the stack trace
- if etype is
SyntaxErrorand value has the appropriate format, it prints the line where the syntax error occurred with a caret indicating the approximate position of the error.
The optional limit argument has the same meaning as for print_tb(). If chain is true (the default), then chained exceptions (the __cause__ or __context__ attributes of the exception) will be printed as well, like the interpreter itself does when printing an unhandled exception.
Please login to continue.