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 Thanks!
a preamble to a lot of my code.
-a-a import (sys, os, ipdb)
-a-a def debug_hook(exc_type, exc_value, traceback):
-a-a-a-a-a-a if exc_type is KeyboardInterrupt:
-a-a-a-a-a-a-a-a-a-a sys.__excepthook__(exc_type, exc_value, traceback) -a-a-a-a-a-a-a-a-a-a return
-a-a-a-a-a-a print(f"Uncaught exception: {exc_type.__name__}: {exc_value}") -a-a-a-a-a-a ipdb.post_mortem(traceback)
-a-a if os.environ.get('DEBUG'): sys.excepthook = debug_hook
debug_hook.py(19)cause_exception()(Pdb) i
return 1 / 0-a # Will raise ZeroDivisionError
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 65 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 16:06:37 |
| Calls: | 863 |
| Calls today: | 1 |
| Files: | 1,311 |
| D/L today: |
11 files (21,614K bytes) |
| Messages: | 265,788 |