File size: 570 Bytes
d758c99 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import sys
class ExceptionHook:
instance = None
def __call__(self, type, value, tb):
if self.instance is None:
if hasattr(sys, 'ps1') or not sys.stderr.isatty():
sys.__excepthook__(type, value, tb)
else:
import traceback
# from IPython.core import ultratb
# self.instance = ultratb.FormattedTB(mode='Plain',
# color_scheme='Linux', call_pdb=1)
import pudb
traceback.print_exception(type, value, tb)
pudb.post_mortem(tb)
sys.excepthook = ExceptionHook() |