IPython Documentation

Table Of Contents

Previous topic


Next topic


This Page


Module: core.crashhandler

Inheritance diagram for IPython.core.crashhandler:

sys.excepthook for IPython itself, leaves a detailed report on disk.


  • Fernando Perez
  • Brian E. Granger


class IPython.core.crashhandler.CrashHandler(app, contact_name=None, contact_email=None, bug_tracker=None, show_crash_traceback=True, call_pdb=False)

Bases: object

Customizable crash handlers for IPython applications.

Instances of this class provide a __call__() method which can be used as a sys.excepthook. The __call__() signature is:

def __call__(self, etype, evalue, etb)
__init__(app, contact_name=None, contact_email=None, bug_tracker=None, show_crash_traceback=True, call_pdb=False)

Create a new crash handler

Parameters :

app : Application

A running Application instance, which will be queried at crash time for internal information.

contact_name : str

A string with the name of the person to contact.

contact_email : str

A string with the email address of the contact.

bug_tracker : str

A string with the URL for your project’s bug tracker.

show_crash_traceback : bool

If false, don’t print the crash traceback on stderr, only generate the on-disk report

Non-argument instance attributes: :

These instances contain some non-argument attributes which allow for :

further customization of the crash handler’s behavior. Please see the :

source for further details. :


Return a string containing a crash report.

message_template = "Oops, {app_name} crashed. We do our best to make it stable, but...\n\nA crash report was automatically generated with the following information:\n - A verbatim copy of the crash traceback.\n - A copy of your input history during this session.\n - Data on your current {app_name} configuration.\n\nIt was left in the file named:\n\t'{crash_report_fname}'\nIf you can email this file to the developers, the information in it will help\nthem in understanding and correcting the problem.\n\nYou can mail it to: {contact_name} at {contact_email}\nwith the subject '{app_name} Crash Report'.\n\nIf you want to do it now, the following command will work (under Unix):\nmail -s '{app_name} Crash Report' {contact_email} < {crash_report_fname}\n\nTo ensure accurate tracking of this issue, please file a report about it at:\n{bug_tracker}\n"
section_sep = '\n\n***************************************************************************\n\n'
IPython.core.crashhandler.crash_handler_lite(etype, evalue, tb)

a light excepthook, adding a small message to the usual traceback