python interactive console in debugger is not "interactive" - python

I am running Pydev 2.7.3 with Eclipse 1.5. I'm trying to use the interactive console with the debugger (i.e. what I would like to do is insert a breakpoint in a file, run the file up to that breakpoint, then muck around with stuff in the interactive debugger). It seems like what I am trying to do fits this exactly: http://pydev.org/manual_adv_debug_console.html
But the interactive console does not DO anything. It prints "pydev debugger: starting", and any prints from before the breakpoint in my file, but when I try to type commands and execute them it is not responsive. It just advances one line and does nothing when I hit enter.
What's the deal? Or how can I start looking under the hood to figure out what is going on here?
EDIT
To be clear, I'm looking for the kind of functionality described here:
Jump into a Python Interactive Session mid-program?
Interactive console using Pydev in Eclipse?
but the "interactive" console that appears (as indicated in the answers to those questions) is not interactive.
EDIT: Problem seems to have resolved. No explanation other than restarting.

Related

PyDev: Running code to interactive console

As my problem is quite simple I'll try to make this question simple aswell. The problem I'm having concerns the PyDev interactive console. I can bring up the console just fine without problems, and even use it as an interactive shell, just as I would be able to with IDLE. However, when I try to run my code that I've written in my project module, it won't run to the interactive console, but to the Eclipse default console. The default console displays the program just fine, but since it's not an interactive shell, I can't do anything afterwards.
With that being said, my question is: How do I get my code to run to the PyDev interactive console, and not the Eclipse default one? Thanks in advance!
For making the symbols of the current editor available in the interactive console, use Ctrl+Alt+Enter (which will do a runfile in the interactive console context).
Also, make sure you read: http://www.pydev.org/manual_adv_interactive_console.html
First it is possible. Second, off top of my head it might be you need to change in preferences where the debug perspective points to? Look through pydev preferences too. Sorry not to be more helpful. Away from computer.
Run the program from the code window. Try hitting F9 whike cyrsor in your code window. Results and bugs should show up in console.

Why is Python's console split in debug perspective in Eclipse with PyDev?

When I launch my Python program with the debugger in Eclipse with PyDev (Python plug-in for Eclipse), the console is always split into two windows. One where I can actually enter code and the other displays my code entries and their output. See the following snippet.
There is also a "dedicated" debug console which I can start whenever my program is paused, but this requires a manual click (PyDev > Debug Console). This console doesn't have the slip view. See snippet.
Why are there two ways to interact with Python while my program is paused? Why is the default console (from the first screenshot) split into two windows? How can I make my default console be more like the second console without the split view?
The second bottom console keeps a history of user commands that are injected into the current context. It provides a cleaner input mechanism with the ability to navigate through a history of commands. In addition some programs running loops may print to the original console frequently making it difficult to print commands into the top console.
It may have been added for future features as well, like changing the context of the input to a different spot in the code.
That is just my guess. There is a "hide console prompt" terminal button if you do not want to see it. Both consoles can have commands entered in if you are debugging and paused.

PyDev interactive console integration with Variables view (Debug perspective)

My issue with the interactive console is twofold:
When I set a breakpoint in my python code, the execution pauses as expected at the breakpoint and displays all my variables in the "Variables" view. However, the interactive console is not very interactive anymore. I would like to be able to play around with the variables when execution is still paused at the breakpoint.
Ideally I would like to have this same behaviour if I'm not debugging but just working in the interactive console. Is there a way to couple the interactive console to the "Variables" view of the "Debug" perspective. When I open an interactive console now the variables view remains empty.
I am running a fresh install of Eclipse Juno (4.4.0) with PyDev (3.7.0).
I am using the latest pydev and I find the interactive console is still interactive :-) Note that no encouraging prompt is present at the console (e.g. no ">") but if you type one of the variables you see in the variables window you will get a value.. can manipulate etc.
My terminology might be a bit lose. If you mean by interactive console the full ">" console then it is tricky to get that to work during debugging. There is a pydev variable you can set to link it to the debug session but I find it a hassle still.. you have to explicitly switch to such a console.. given a command.. it then throws you back to the normal debug console (which is the one I was referencing as still sensitive to typing variable names etc).. Perhaps I am doing something wrong though for it to be so awkward. I posted on this a few weeks back but there was no reply. I too would like to do debugging in the full console with no hassle. In particular I would like to be able to use its command history to more efficiently manipulate things.
But regardless you can still debug and look at variables just not with the full feature console easily.
Also be aware there seems to be a bug lately (last few releases) where the variables view stays blank. I find that if I close it and reopen it then the variables appear.
Good luck

debug script with pydev in eclipse

I have used standart ide for python - IDLE for a long time. It has convinient debug. I can write script, press F5 and it is possible to use all objects in terminal.
Now i want working with eclipse and pydev plugin. Is there any similar way to debug in eclipse?
Yes, there is.
Just start debugging - as far as I know, you have to set breakpoint, otherwise program just run to the end. And when stopped at breakpoint, in console window, click open console icon -> choose pydev console -> PyDev Debug Console.
Let me know if it works for you.
The PyDev debugger should be better to work with breakpoints and in a context... See: http://pydev.org/manual_101_run.html for basic instructions.
Note that when in a breakpoint you can simply issue commands in the console to print variables, etc.
Now, just for completeness, what IDLE has is closer to the PyDev interactive console: http://pydev.org/manual_adv_interactive_console.html Mostly, press Ctrl+Alt+Enter in your file and it'll execute the file in a buffer for you to work interactively.

Interactive console using Pydev in Eclipse?

I'm debugging my Python code in Eclipse using the Pydev plugin. I'm able to open a Pydev console and it gives me two options: "Console for currently active editor" and "Python console". However none of them is useful to inspect current variable status after a breakpoint.
For example, the code stopped at a breakpoint and I want to inspect an "action" variable using the console. However my variables are not available. How can I do things like "dir(action)", etc? (even if it is not using a console).
This feature is documented here:
http://pydev.org/manual_adv_debug_console.html
The console that opens in the debug perspective is in fact interactive, although it took me a while to realize it. You need to hit return twice after typing something and then it gets evaluated.
More info on the Pydev site here: http://pydev.org/manual_adv_debug_console.html
Double click on "action" or any other variable.
ctrl+shift+D
And if you're using watches, I cant imagine better interaction. You are able to see every change.
When I set a break point and hit F11 Eclipse launches the debugger and prompts to open the "Debug Perspective". You can then open the Window-->Show View --> Expressions which opens the expressions view, you can then right click in the Expressions view windows and choose "Add Watch Expression" to add any expression(such as dir)
Conversely I was also able to type in dir(some expression) in the PyDev console and get the same effect.
I'm using PyDev 1.4.6.2788
On a small monitor, you may not realize that the debug interactive console is different from the regular interactive console: it has a second command prompt at the bottom where you type, not at the top like the normal console.

Categories