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,073 |
Nodes: | 10 (0 / 10) |
Uptime: | 228:05:55 |
Calls: | 13,783 |
Calls today: | 1 |
Files: | 186,987 |
D/L today: |
1,085 files (387M bytes) |
Messages: | 2,435,085 |