[bluec0re] Make ipython_view compatible to version >= 1.0. Fixes #7868

This commit is contained in:
Yann Leboulanger 2014-10-26 16:37:11 +01:00
parent 89347ffdd9
commit 818a403a3f
1 changed files with 8 additions and 2 deletions

View File

@ -92,6 +92,9 @@ class IterableIPShell:
@type input_func: function
"""
if input_func:
if IPython.version_info[0] >= 1:
IPython.terminal.interactiveshell.raw_input_original = input_func
else:
IPython.frontend.terminal.interactiveshell.raw_input_original = input_func
if cin:
IPython.utils.io.stdin = IPython.utils.io.IOStream(cin)
@ -112,6 +115,9 @@ class IterableIPShell:
cfg = Config()
cfg.InteractiveShell.colors = "Linux"
if IPython.version_info[0] >= 1:
self.IP = IPython.terminal.embed.InteractiveShellEmbed(config=cfg, user_ns=user_ns)
else:
self.IP = IPython.frontend.terminal.embed.InteractiveShellEmbed(config=cfg, user_ns=user_ns)
self.IP.system = lambda cmd: self.shell(self.IP.var_expand(cmd),
header='IPython system call: ',