Changeset 2621 for trunk/bin


Ignore:
Timestamp:
08/06/12 12:15:11 (12 years ago)
Author:
Malte Marquarding
Message:

allow for ipython >=0.10 (both 0.10 and 0.11)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/asap

    r2499 r2621  
    22import os
    33
    4 def main():
     4def main10():
     5    from IPython.Shell import IPShellEmbed
     6
     7    banner = "HELLO"
     8    exit_msg = "bye"
     9   
     10    ipshell = IPShellEmbed(sys.argv[1:],banner,exit_msg)
     11    return ipshell
     12
     13
     14def main11():
    515    from IPython.config.loader import Config
    616    cfg = Config()
     
    1929                                    banner1 = welcome(),
    2030                                    exit_msg = '')
    21     ipshell()
     31    return ipshell
    2232
    2333try:
     
    2535    import IPython
    2636    from asap import *
    27     main()
     37    vers = int(IPython.__version__.split(".")[1])
     38    if vers >= 11:
     39        ipshell = main11()
     40    else:
     41        ipshell = main10()
     42
    2843except ImportError:
    29     print "No ipython found. Running standard python"
     44    banner =  "No ipython found. Running standard python"
     45    import code
    3046    from asap import *
     47    del main
     48    code.interact(banner, local=locals())
Note: See TracChangeset for help on using the changeset viewer.