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,075 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 88:00:20 |
| Calls: | 13,797 |
| Files: | 186,989 |
| D/L today: |
4,520 files (1,286M bytes) |
| Messages: | 2,438,135 |