def excepthook(self, etype, value, tb):
    'One more defense for GUI apps that call sys.excepthook.\n\n        GUI frameworks like wxPython trap exceptions and call\n        sys.excepthook themselves.  I guess this is a feature that\n        enables them to keep running after exceptions that would\n        otherwise kill their mainloop. This is a bother for IPython\n        which expects to catch all of the program exceptions with a try:\n        except: statement.\n\n        Normally, IPython sets sys.excepthook to a CrashHandler instance, so if\n        any app directly invokes sys.excepthook, it will look to the user like\n        IPython crashed.  In order to work around this, we can disable the\n        CrashHandler and replace it with this excepthook instead, which prints a\n        regular traceback using our InteractiveTB.  In this fashion, apps which\n        call sys.excepthook will generate a regular-looking exception from\n        IPython, and the CrashHandler will only be triggered by real IPython\n        crashes.\n\n        This hook should be used sparingly, only in places which are not likely\n        to be true IPython errors.\n        '
    self.showtraceback((etype, value, tb), tb_offset=0)
One more defense for GUI apps that call sys.excepthook.

GUI frameworks like wxPython trap exceptions and call
sys.excepthook themselves.  I guess this is a feature that
enables them to keep running after exceptions that would
otherwise kill their mainloop. This is a bother for IPython
which expects to catch all of the program exceptions with a try:
except: statement.

Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
any app directly invokes sys.excepthook, it will look to the user like
IPython crashed.  In order to work around this, we can disable the
CrashHandler and replace it with this excepthook instead, which prints a
regular traceback using our InteractiveTB.  In this fashion, apps which
call sys.excepthook will generate a regular-looking exception from
IPython, and the CrashHandler will only be triggered by real IPython
crashes.

This hook should be used sparingly, only in places which are not likely
to be true IPython errors.
def excepthook(self, etype, value, tb):
    'One more defense for GUI apps that call sys.excepthook.\n\n        GUI frameworks like wxPython trap exceptions and call\n        sys.excepthook themselves.  I guess this is a feature that\n        enables them to keep running after exceptions that would\n        otherwise kill their mainloop. This is a bother for IPython\n        which expects to catch all of the program exceptions with a try:\n        except: statement.\n\n        Normally, IPython sets sys.excepthook to a CrashHandler instance, so if\n        any app directly invokes sys.excepthook, it will look to the user like\n        IPython crashed.  In order to work around this, we can disable the\n        CrashHandler and replace it with this excepthook instead, which prints a\n        regular traceback using our InteractiveTB.  In this fashion, apps which\n        call sys.excepthook will generate a regular-looking exception from\n        IPython, and the CrashHandler will only be triggered by real IPython\n        crashes.\n\n        This hook should be used sparingly, only in places which are not likely\n        to be true IPython errors.\n        '
    self.showtraceback((etype, value, tb), tb_offset=0)