On this page
sys.excepthook
Prev: sys.exc_info | Up: sys | Next: sys.exception
Rel: sys.activate_stack_trampoline, sys.addaudithook, sys.audit, sys.breakpointhook
Ref: docs.python.org — sys.excepthook
Tags: #public #python3 #stdlib #sys
Import
import sys
from sys import excepthook
Signature & Overview
sys.excepthook(exctype, value, traceback, /)
Handle an exception by displaying it with a traceback on sys.stderr.
Usage
import sys
# Default top-level handler for uncaught exceptions on the main thread
assert callable(sys.excepthook)
Gotchas
- Main thread only: Uncaught exceptions in worker threads go to
threading.excepthook, notsys.excepthook.
REPL Inspect
from sys import excepthook
help(excepthook)
Linked from
Related notes
- tuts/python3/stdlib_module/sys/exc_info Linked here; links to this page; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/exception Linked here; links to this page; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sys/activate_stack_trampoline Linked here; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/addaudithook Linked here; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/audit Linked here; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/breakpointhook Linked here; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/call_tracing shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/deactivate_stack_trampoline shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/displayhook shared tags: #stdlib, #sys