Name
excepthook
Synopsis
excepthook(type
,value
,traceback
)
When an exception is not caught by any handler, Python calls
excepthook
, passing it the exception class,
exception object, and traceback object, as covered in Chapter 6. The default excepthook
displays the error and traceback. You can rebind
sys.excepthook
to change what is displayed for
uncaught exceptions (just before Python returns to the interactive
loop or terminates). The original value is also available as
sys.__excepthook__
.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.