def post_mortem_excepthook(type, value, tb):
 clear_post_mortem()
 if IS_IPYKERNEL:
  from IPython.core.getipython import get_ipython
  ipython_shell = get_ipython()
  ipython_shell.showtraceback((type, value, tb))
  p = pdb.Pdb(ipython_shell.colors)
 else:
  traceback.print_exception(type, value, tb, file=sys.stderr)
  p = pdb.Pdb()
 if (not (type == SyntaxError)):
  time.sleep(0.1)
  _print(('*' * 40))
  _print('Entering post mortem debugging...')
  _print(('*' * 40))
  p.send_initial_notification = False
  p.reset()
  frame = tb.tb_frame
  prev = frame
  while frame.f_back:
   prev = frame
   frame = frame.f_back
  frame = prev
  time.sleep(0.1)
  p.interaction(frame, tb)

def post_mortem_excepthook ( type , value , tb ) : clear_post_mortem ( ) if IS_IPYKERNEL : from IPython . core . getipython import get_ipython ipython_shell = get_ipython ( ) ipython_shell . showtraceback ( ( type , value , tb ) ) p = pdb . Pdb ( ipython_shell . colors ) else : traceback . print_exception ( type , value , tb , file = sys . stderr ) p = pdb . Pdb ( ) if ( not ( type == SyntaxError ) ) : time . sleep ( 0.1 ) _print ( ( '*' * 40 ) ) _print ( 'Entering post mortem debugging...' ) _print ( ( '*' * 40 ) ) p . send_initial_notification = False p . reset ( ) frame = tb . tb_frame prev = frame while frame . f_back : prev = frame frame = frame . f_back frame = prev time . sleep ( 0.1 ) p . interaction ( frame , tb )
for post mortem exception handling .