PyDev Interactive Python Shell in Eclipse

Joohwan picture Joohwan · Aug 20, 2013 · Viewed 16.6k times · Source

I've been using Wing IDE for python programming and I am trying to switch to Eclipse, PyDev.

When I run my code in Wing IDE, after finishing the execution the console goes right back to the interactive shell and I can continue on testing, but I don't know how to do this in Eclipse. I'm not sure if I am describing my problem properly so I'll use an example:

Let's say I had a simple source code that looked like this (e.g. test.py):

print("hello")

When I run this in Wing IDE by clicking that green arrow, the console would look like this after execution:

Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)]
Type "help", "copyright", "credits" or "license" for more information.
[evaluate untitled-1.py]
hello
>>>>

And I can keep doing whatever on the shell and it would know my code (defined functions etc.). But when I do the same thing in Eclipse, the console would simply look like this:

hello

and I have to click "Remove All Terminated Launches" button to go back to the shell.

Can this be done in Eclipse?

Answer

Fabio Zadrozny picture Fabio Zadrozny · Aug 22, 2013

What you want to use is the interactive console in PyDev (not the regular output when you do a run).

To use it do: Ctrl+Alt+Enter.

Note that if you're in the middle of a debug session, you can also use the debug session console to interact with the program.

It can also be created from the UI in the console view as shown below:

[Create PyDev interactive console [1]