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

Randy Heiland heiland@indiana....
Tue Sep 13 03:59:20 CDT 2011


Thanks for the reply Paul.  See below:

On Sep 13, 2011, at 12:34 AM, Paul Ivanov wrote:

> 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. 

Oops - yes, I did.

> 
>> :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. 

Ah, OK, I hadn't copied the connection string before doing the :IPythonClipboard.  That's OK now, I guess (no 'failed' msg anyway).

> 
>> 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.

I'm not sure I'm parsing your comment correctly, but I'm not seeing any "hidden" output in the qtconsole using '_'.  Regardless, see next comment…

> 
>> 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'")

I'm not sure what you mean by running "from inside screen".  I simply issue my 'vim' from a Mac "Terminal" (bash) shell.  Nothing shows up in qtconsole when I do this from my vim session (and I also tried doing the '_' in the qtconsole to see if it was somehow hidden.

Maybe I'll get around to trying this on a Windows machine in the next few days just to see if things work for me there.

> 
> best,
> -- 
> Paul Ivanov
> 314 address only used for lists,  off-list direct email at:
> http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user



More information about the IPython-User mailing list