From 818a403a3f28c3c6d4edcee288c65717a0b3fe36 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 26 Oct 2014 16:37:11 +0100 Subject: [PATCH] [bluec0re] Make ipython_view compatible to version >= 1.0. Fixes #7868 --- src/ipython_view.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ipython_view.py b/src/ipython_view.py index 8eb1146c0..13f5e1f19 100644 --- a/src/ipython_view.py +++ b/src/ipython_view.py @@ -92,7 +92,10 @@ class IterableIPShell: @type input_func: function """ if input_func: - IPython.frontend.terminal.interactiveshell.raw_input_original = 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) if cout: @@ -112,7 +115,10 @@ class IterableIPShell: cfg = Config() cfg.InteractiveShell.colors = "Linux" - self.IP = IPython.frontend.terminal.embed.InteractiveShellEmbed(config=cfg, user_ns=user_ns) + 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: ', local_ns=user_ns)