Created
May 14, 2025 16:14
-
-
Save derrickturk/c7df279e85e433a877a67643787be4c1 to your computer and use it in GitHub Desktop.
Python: register the debugger to run in an uncaught exception hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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