It's often useful to do this in standalone Python programs:
def excepthook(typ, value, tb):
traceback.print_exception(typ, value, tb)
pdb.pm()
...
if log.getEffectiveLevel() == logging.DEBUG:
sys.excepthook = excepthook
(i.e. if uncatched exception happens, program is dropped into pdb
post-mortem mode)
But that doesn't work with Tornado ioloop bc it seems that ioloop catches uncatched exceptions and prints or logs them. If I install above hook, the program enters post-mortem mode only on pressing Ctrl-C which is kind of late. :-)
Is there a way of making this happen without monkey-patching Tornado?