user17375
user17375

Reputation: 529

display output from a vim <F5> ".py script execution in the ipython console

I am using gvim in interaction with IPython 0.12 on a linux box.

I would like to see the output of my *.py script displayed in the Ipython console, but I haven't managed to tweak the parameters accordingly.

Typically if I write something like

print sum([1,2 3]) 

I would expect the result to display in the console. Actually I only get a message displayed in the lower vim area giving an input number for the execution (In[2] say). But the display In[1] wouldn't change in the Ipython konsole.

Thanks for insight.

Upvotes: 2

Views: 577

Answers (2)

Paul Ivanov
Paul Ivanov

Reputation: 2024

I'm one of the IPython developers, and wrote vim-ipython (from which you're using ipy.vim).

The behavior you are seeing is simply a wanted feature that has not been implemented in IPython yet: ipython console, ipython qtconsole, and the web notebook do not currently print activity that they did not initiate. See the discussion on issue #1873 for this planned feature enhancement.

The In[] prompt will get update once you actually try to send a new command in ipython's qtconsole.

Upvotes: 1

user1902824
user1902824

Reputation:

What you said sounds like the expected result, but I think I know what you are going for.

You could use something like tmux to send a command to a terminal session (using send-keys). So you would have one terminal that shows the output of your program, and another with vim. Vim would send a command (something along the lines of tmux send-keys "python your.program^M") to the other terminal to run your script.

Another option you have is to have vim execute your script, but redirect the output to a file. Vim would execute something like python yourscript.py > /tmp/out & and your other terminal would be running tail -F /tmp/out so it will continuously update.

Upvotes: 2

Related Questions