traceback.print_exc()

traceback.print_exc(limit=None, file=None)[source]

Shorthand for ‘print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback, limit, file)’. (In fact, it uses sys.exc_info() to retrieve the same information in a thread-safe way.)