def set_post_mortem():
 if IS_IPYKERNEL:
  from IPython.core.getipython import get_ipython
  def ipython_post_mortem_debug(shell, etype, evalue, tb, tb_offset=None):
   post_mortem_excepthook(etype, evalue, tb)
  ipython_shell = get_ipython()
  ipython_shell.set_custom_exc((Exception,), ipython_post_mortem_debug)
 else:
  sys.excepthook = post_mortem_excepthook

def set_post_mortem ( ) : if IS_IPYKERNEL : from IPython . core . getipython import get_ipython def ipython_post_mortem_debug ( shell , etype , evalue , tb , tb_offset = None ) : post_mortem_excepthook ( etype , evalue , tb ) ipython_shell = get_ipython ( ) ipython_shell . set_custom_exc ( ( Exception , ) , ipython_post_mortem_debug ) else : sys . excepthook = post_mortem_excepthook
enable the post mortem debugging excepthook .