def setup_exceptionhook(ipython=False):
    'Overloads default sys.excepthook with our exceptionhook handler.\n\n       If interactive, our exceptionhook handler will invoke\n       pdb.post_mortem; if not interactive, then invokes default handler.\n    '

    def _datalad_pdb_excepthook(type, value, tb):
        import traceback
        traceback.print_exception(type, value, tb)
        print()
        if is_interactive():
            import pdb
            pdb.post_mortem(tb)
    if ipython:
        from IPython.core import ultratb
        sys.excepthook = ultratb.FormattedTB(mode='Verbose', call_pdb=is_interactive())
    else:
        sys.excepthook = _datalad_pdb_excepthook
Overloads default sys.excepthook with our exceptionhook handler.

If interactive, our exceptionhook handler will invoke
pdb.post_mortem; if not interactive, then invokes default handler.
def setup_exceptionhook(ipython=False):
    'Overloads default sys.excepthook with our exceptionhook handler.\n\n       If interactive, our exceptionhook handler will invoke\n       pdb.post_mortem; if not interactive, then invokes default handler.\n    '

    def _datalad_pdb_excepthook(type, value, tb):
        import traceback
        traceback.print_exception(type, value, tb)
        print()
        if is_interactive():
            import pdb
            pdb.post_mortem(tb)
    if ipython:
        from IPython.core import ultratb
        sys.excepthook = ultratb.FormattedTB(mode='Verbose', call_pdb=is_interactive())
    else:
        sys.excepthook = _datalad_pdb_excepthook