Recently I have been increasingly adding this piece of code as
a preamble to a lot of my code.
import (sys, os, ipdb)
def debug_hook(exc_type, exc_value, traceback):
if exc_type is KeyboardInterrupt:
sys.__excepthook__(exc_type, exc_value, traceback)
return
print(f"Uncaught exception: {exc_type.__name__}: {exc_value}")
ipdb.post_mortem(traceback)
if os.environ.get('DEBUG'): sys.excepthook = debug_hook
debug_hook.py(19)cause_exception()(Pdb) i
return 1 / 0 # Will raise ZeroDivisionError
Hi,
Recently I have been increasingly adding this piece of code as
a preamble to a lot of my code.
import (sys, os, ipdb)
def debug_hook(exc_type, exc_value, traceback):
if exc_type is KeyboardInterrupt:
sys.__excepthook__(exc_type, exc_value, traceback)
return
print(f"Uncaught exception: {exc_type.__name__}: {exc_value}")
ipdb.post_mortem(traceback)
if os.environ.get('DEBUG'): sys.excepthook = debug_hook
Recently I have been increasingly adding this piece of code as
a preamble to a lot of my code.
import (sys, os, ipdb)
def debug_hook(exc_type, exc_value, traceback):
if exc_type is KeyboardInterrupt:
sys.__excepthook__(exc_type, exc_value, traceback) return
print(f"Uncaught exception: {exc_type.__name__}: {exc_value}") ipdb.post_mortem(traceback)
if os.environ.get('DEBUG'): sys.excepthook = debug_hook
debug_hook.py(19)cause_exception()(Pdb) i
return 1 / 0 # Will raise ZeroDivisionError
Sysop: | Tetrazocine |
---|---|
Location: | Melbourne, VIC, Australia |
Users: | 14 |
Nodes: | 8 (0 / 8) |
Uptime: | 12:27:43 |
Calls: | 178 |
Files: | 21,502 |
Messages: | 78,115 |