Skip to content

Instantly share code, notes, and snippets.

@derrickturk
Created May 14, 2025 16:14
Show Gist options
  • Save derrickturk/c7df279e85e433a877a67643787be4c1 to your computer and use it in GitHub Desktop.
Save derrickturk/c7df279e85e433a877a67643787be4c1 to your computer and use it in GitHub Desktop.
Python: register the debugger to run in an uncaught exception hook
def _debug() -> None:
import sys
import pdb
import traceback
def debughook(etype, value, tb):
traceback.print_exception(etype, value, tb)
print() # make a new line before launching post-mortem
pdb.pm() # post-mortem debugger
sys.excepthook = debughook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment