From c2e76b0c526ec3ad2c923362d750b54d509120f8 Mon Sep 17 00:00:00 2001 From: Edward Stone Date: Sun, 2 Mar 2014 17:25:55 +0800 Subject: [PATCH] Fix bug: Namespace switch prevents LT from returning eval result if source file contains errors. --- py-src/ltipy.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/py-src/ltipy.py b/py-src/ltipy.py index f3229c5..292df63 100644 --- a/py-src/ltipy.py +++ b/py-src/ltipy.py @@ -17,6 +17,7 @@ def noop(): requests = {} connected = noop disconnected = noop +curNs = None def km_from_string(s=''): """create kernel manager from IPKernelApp string @@ -183,7 +184,10 @@ def initIPy(s): disconnected() def setNs(path): + if path==curNs: return send("import lttools\nlttools.switch_ns('" + path.replace('\\', '\\\\') + "')") + time.sleep(0.1) #wait for msgloop to clear this namespace switch + path = curNs def IPyOutput(l): m = re.search('--existing (.*\.json)', l)