[IPython-User] vim-ipython (on OSX Lion)

Paul Ivanov pivanov314@gmail....
Mon Sep 12 23:34:06 CDT 2011


Randy Heiland, on 2011-09-10 15:26,  wrote:
> Hi all,
> 
> Apparently I need a little hand-holding to figure out the vim-ipython stuff...
> 
> 1) start ipython:
> ~/git/ipython$ python ipython.py qtconsole
> [IPKernelApp] To connect another client to this kernel, use:
> [IPKernelApp] --existing --shell=56169 --iopub=56170 --stdin=56171 --hb=56172
> 
> -->  the qtconsole:
> Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) 
> Type "copyright", "credits" or "license" for more information.
> 
> IPython 0.12.dev -- An enhanced Interactive Python.
> ...
> 
> 2) had to build vim from source as my default vim wasn't built w/ Python enabled.
> ~$ vim --version
> VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Sep 10 2011 14:29:54)
> MacOS X (unix) version
> … +python -python3 …
> 
> 
> 3) from a terminal window:  (Note that I'm not running X11)
> ~$ python foo.py

I'm assuming you meant 'vim foo.py' above, given your next set of
commands. 

> :echo has('python')  --> 1
> 
> :source /Users/heiland/git/vim-ipython/ftplugin/python/ipy.vim  --> no error; no feedback
> 
> :IPythonClipboard
> --> results in the following:
> :IPython :source /Users/heiland/git/vim-ipython/ftplugin/python/ipy.vim^@ failed
> ^-- failed --shell not specified
> Press ENTER or type command to continue

The IPythonClipboard command is meant to work when you've copied
the connection string. If that's what you did do, please file a
bug against vim-ipython, and I will look into this. It could be
that vim doesn't have access to the clipboard in the same way on
OS X as it that it does on the other platforms. 
 
> At this point, I assume things have gone bad, but I try to forge ahead with:
> :IPython --existing --shell=56169 --iopub=56170 --stdin=56171 --hb=56172
> 
> and then try to enter a 'import os'<ctl-s>, but it doesn't appear in the qtconsole.

Last time I checked, though this may have changed, the qtconsole
doesn't listen on subchannel (the way, the vim-ipython shell,
does, for example) to see what other clients are sending to the
kernel, and redisplay the output. In the qtconsole, you can check
the last Out variable which is just called _

The way to check if you line worked is if just 'os' caused a
NameError before you hit Ctrl-S on the import os line, and
returns <module 'os' from '/path/to/your/python2.6/os.pyc'>
afterwards.

> Does anyone have some advice?

Another possibility is that the Ctrl-S isn't working for you,
which might be the case if you're running from inside screen. On
successful connection, vim-ipython binds the kernel manager's
shell_channel.execute function to send, so you can try sending
this command from vim

:py send("vim_ipython='works'")

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://mail.scipy.org/pipermail/ipython-user/attachments/20110912/889c9270/attachment.bin 


More information about the IPython-User mailing list