@@ -78,12 +78,25 @@ except NameError:
7878 kc = None
7979 pid = None
8080
81+ _install_instructions = " " " You *must* install IPython into the Python that
82+ your vim is linked against. If you are seeing this message, this usually means
83+ either (1 ) installing IPython using the system Python that vim is using, or
84+ (2 ) recompiling Vim against the Python where you already have IPython
85+ installed. This is only a requirement to allow Vim to speak with an IPython
86+ instance using IPython's own machinery. It does * not* mean that the IPython
87+ instance with which you communicate via vim - ipython needs to be running the
88+ same version of Python.
89+ " ""
8190def km_from_string (s = ' ' ):
8291 " ""create kernel manager from IPKernelApp string
8392 such as ' --shell=47378 --iopub=39859 --stdin=36778 --hb=52668' for IPython 0.11
8493 or just ' kernel-12345.json' for IPython 0.12
8594 " ""
8695 from os.path import join as pjoin
96+ try :
97+ import IPython
98+ except ImportError:
99+ raise ImportError (" Could not find IPython. " + _install_instructions)
87100 from IPython.config.loader import KeyValueConfigLoader
88101 from Queue import Empty
89102 try :
@@ -432,8 +445,8 @@ def with_subchannel(f,*args):
432445
433446@w ith_subchannel
434447def run_this_file ():
435- msg_id = send (' run %s %s' % (run_flags, repr (vim .current.buffer .name),))
436- print_prompt (" In[]: run %s %s" % (run_flags, repr (vim .current.buffer .name)),msg_id)
448+ msg_id = send (' %% run %s %s' % (run_flags, repr (vim .current.buffer .name),))
449+ print_prompt (" In[]: %% run %s %s" % (run_flags, repr (vim .current.buffer .name)),msg_id)
437450
438451@w ith_subchannel
439452def run_this_line ():
0 commit comments