Changeset 1563


Ignore:
Timestamp:
Nov 5, 2014 4:02:44 PM (7 years ago)
Author:
toby
Message:

manage with IPython 0.12 from EPD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpath.py

    r1558 r1563  
    314314    '''
    315315    savehook = sys.excepthook # save the exception hook
    316     from IPython.terminal.embed import InteractiveShellEmbed
     316    try:
     317        from IPython.terminal.embed import InteractiveShellEmbed
     318    except ImportError:
     319        try:
     320            # try the IPython 0.12 approach
     321            from IPython.frontend.terminal.embed import InteractiveShellEmbed
     322        except ImportError:
     323            print 'IPython InteractiveShellEmbed not found'
     324            return
    317325    import inspect
    318326    ipshell = InteractiveShellEmbed()
     
    332340    from IPython.core import ultratb
    333341    ultratb.FormattedTB(call_pdb=False,color_scheme='LightBG')(*args)
    334     from IPython.terminal.embed import InteractiveShellEmbed
     342    try:
     343        from IPython.terminal.embed import InteractiveShellEmbed
     344    except ImportError:
     345        try:
     346            # try the IPython 0.12 approach
     347            from IPython.frontend.terminal.embed import InteractiveShellEmbed
     348        except ImportError:
     349            print 'IPython InteractiveShellEmbed not found'
     350            return
    335351    import inspect
    336352    frame = inspect.getinnerframes(args[2])[-1][0]
    337353    msg   = 'Entering IPython console at {0.f_code.co_filename} at line {0.f_lineno}'.format(frame)
     354    savehook = sys.excepthook # save the exception hook
    338355    InteractiveShellEmbed(banner1=msg)(local_ns=frame.f_locals,global_ns=frame.f_globals)
     356    sys.excepthook = savehook # reset IPython's change to the exception hook
    339357
    340358def DoNothing():
Note: See TracChangeset for help on using the changeset viewer.