[yt-svn] commit/yt: brittonsmith: Fixing ipython version 0.11 issue for command_line.
Bitbucket
commits-noreply at bitbucket.org
Mon Nov 14 15:09:17 PST 2011
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/changeset/2e021f76e045/
changeset: 2e021f76e045
branch: yt
user: brittonsmith
date: 2011-11-15 00:09:10
summary: Fixing ipython version 0.11 issue for command_line.
Closes #297.
affected #: 1 file
diff -r 212866fe2532d4509f8df79f7ea9bf22f23a62ec -r 2e021f76e045f9a4da12e2f772715f8aa34c880d yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -466,14 +466,29 @@
print "Could not load file."
sys.exit()
import yt.mods
- from IPython.Shell import IPShellEmbed
+
+ import IPython
+ if IPython.__version__.startswith("0.10"):
+ api_version = '0.10'
+ elif IPython.__version__.startswith("0.11"):
+ api_version = '0.11'
+
local_ns = yt.mods.__dict__.copy()
local_ns['pf'] = pf
- shell = IPShellEmbed()
- shell(local_ns = local_ns,
- header =
- "\nHi there! Welcome to yt.\n\nWe've loaded your parameter file as 'pf'. Enjoy!"
- )
+
+ if api_version == '0.10':
+ shell = IPython.Shell.IPShellEmbed()
+ shell(local_ns = local_ns,
+ header =
+ "\nHi there! Welcome to yt.\n\nWe've loaded your parameter file as 'pf'. Enjoy!"
+ )
+ else:
+ from IPython.config.loader import Config
+ cfg = Config()
+ cfg.InteractiveShellEmbed.local_ns = local_ns
+ IPython.embed(config=cfg)
+ from IPython.frontend.terminal.embed import InteractiveShellEmbed
+ ipshell = InteractiveShellEmbed(config=cfg)
@add_cmd_options(['outputfn','bn','thresh','dm_only','skip'])
@check_args
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list