1
votes

So I installed PyDev in Eclipse and started testing it and I have come to an issue.

While using IDLE to run Python I could, for example, create a file, set a variable x = 10 and then make IDLE run said file. I would then be able to ask python for x and it would give me 10. I don't know how to do that in PyDev.

I created a python interactive console and then when prompted chose the "Console for currently active editor" but the console will not recognize x even though the editor has x defined to 10. I did save before creating the console, I also ran the file before I opened the console... I do not know what to do...

Thank you!

2

2 Answers

0
votes

Hmmm, I am not familiar with the IDE IDLE, nor do I typically run a file via the console, but maybe I understand your question. The core answer is you need a breakpoint so that execution does not terminate and therefore x=10 is resident in memory. If the breakpoint is set post x=10, then when you reach the breakpoint and execution stops and you type "x" you will get 10. There is documentation online on the console about how to use it in context of a load of file from with the console. I tend instead to hit shift-F9 while in the file to run it in debug mode. This leaves you in debug console rather than interactive console (you'll see no prompting ">") but you'll still be able to have x=10 when you enter x at break. Probably misunderstood but though I would give it a shot. Good luck!

0
votes

After creating the console you have to do an execfile of the python in the console... (ctrl+alt+enter).

See: http://pydev.org/manual_adv_interactive_console.html for details

Note that I believe the current version has an issue with that command -- but I'll probably do a release tomorrow which has a fix for that (PyDev 3.8)