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 asThanks!
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: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,070 |
Nodes: | 10 (0 / 10) |
Uptime: | 159:51:55 |
Calls: | 13,734 |
Calls today: | 2 |
Files: | 186,966 |
D/L today: |
826 files (296M bytes) |
Messages: | 2,418,694 |