From Python docs:
sys.excepthook(type, value, traceback) This function prints out a given traceback and exception to sy
sys.excepthook(type, value, traceback)
This function prints out a given traceback and exception to sy
sy
Try:
import pdb import sys def excepthook(type, value, traceback): pdb.post_mortem(traceback) excepthook.old = sys.excepthook sys.excepthook = excepthook def raise_exception(): raise_exception() raise_exception()