How to inspect variables form interactive console in PyDev - eclipse

How can I run code in the Interactive Console in PyDev and see the created variables in the Variables view?
I am looking for the same functionality available in Spyder. If I am interactively running a script or just testing pieces, I would like o be able to see all the available shell variables and their respective values in the variables view.
I have already checked "Connect console to Debug Session" in Preferences > Pydev > Interactive console.
But when I run, say, a=1, the "Variables" view will be in italic for a moment and nothing appears there.
ANSWER
Following Fabio's advice: I updated Pydev from v5.4 to 5.8. That did it.

Not sure what's happening there.
For me, after checking Connect console to Debug Session in Preferences > PyDev > Interactive console, I do see created variables in the variables view.
Are you actually using the interactive console (i.e.: started with Ctrl+Alt+Enter)?
Can you show a screenshot with Eclipse on that situation?
Which PyDev version are you using?

Related

How to use Terminal View in Eclipse

By default projects run in Eclipse that has console output will bring focus to the console window and display the output there.
Eclipse has a Local Terminal option. Is there a configuration that will activate this as the output destination for a running project?
Before upgrading to Neon I was using an ansi plugin for the console, which isn't installing properly in this current version (ansi-escape-console). While it might be a temporary glitch, now is a good time to learn how to use the Local Terminal alternative.
I'm trying to have the ansi escape codes displayed in scripts like:
#!/bin/bash
RED='\033[0;31m'
NC='\033[0m'
printf "Hello... ${RED}This is red highlighted text ${NC}.\n"
Update: I was able to get the ANSI Escape in Console plugin from the Marketplace installed. I still would like to know how to specify the output to the Local Terminal view as an option.
There is a difference between the Console view and the Terminal view.
Console View
The console view is a facility for the output of the applications running in IDE of eclipse (for test and debugging).
Terminal View
The Terminal View is a terminal emulator for access to the local computer's shell.
While I wanted to see the Ansi Color output and other escaped sequences of the IDE console running programs, this is done using the Marketplace upgrade of the ANSI Escape on Console plugin.

Enter pydev interactive console immediately on F11?

I would like to F11 a python file in Eclipse and when I hit a breakpoint automatically enter the Python Interactive Console (not the default pydev debug console).
I understand that I could upon entering debug mode open a new interactive python console (I have turned on the connection between the interactive console and the debug console) and work from there. But not only is that an extra step but it is frustrating because everytime I interact with such an interactive console it shoves me back to the debug console! Then I have to go review the interactive console. I also understand that I could do a 'runfile' from within the interactive console, but I really want to use the convenient F11 capacity of eclipse to just be in an editor, hit F11 and when I break enter the interactive console.
Basically I would like the Interactive Console to be my debug console. Possible?
If the F11 approach is not possible, is there another approach? My goal is to get my history of command typing available to me with arrow keys. Not possible in the default python debug console from what I can tell. Perhaps if I made the pydev debug console ipython?
Thanks, I have searched a lot on this but can't come up with a solution.
from PyDev 3.9.2 onwards, a console prompt with history, code-completion, etc. will appear automatically.
See: http://pydev.blogspot.com.br/2015/02/pydev-392-released.html for details.

Ipython in pydev interactive debugging console(eclipse)

I have ipython working in pydev when using the normal interactive console, however when entering debug mode the console reverts to the standard pydev console. If I close this console and re-open it, ipython returns and I can use it as normal. Am I missing something, or is this a bug?
-Eric
Actually since PyDev version 3.0 you can attache a IPython console to a debug-session:
http://pydev.org/manual_adv_interactive_console.html#full-debug-support-in-interactive-console
To enable that feature, go to window > preferences > PyDev > Interactive Console and check 'Connect console to Debug Session?'.
Then only hassle is that you have to re-open a new IPython-console every time you re-launch the program in debug-mode.
Actually, Eclipse itself can have multiple consoles open at the same time... if you want, you can create multiple console views and pin a different console to each view (if you don't pin the console, one console will be shown on top of the other and you'll have to do the switching from one to the other manually).
As it is now, the debug console is not the same as the interactive console (it's a simpler version because of issues with the eclipse integration, although there are plans to be able to attach an interactive console to a debug session).
So, what you described is what should really happen (not really a bug).

How to use the GDB console in Eclipse CDT?

Is there a way how I can access gdb's console in Eclipse? I would like to just be able to set breakpoints with the mouse and then use the console for debugging.
You must click here
Next select one with *gdb
Now you can write GDB commands in console example:
First of all, you need to install CDT plugin. Then, you can debug C++ application like Java application in Eclipse.
If you want gdb console, push 'Display Selected Console' in Console view in Debug perspective.
You can choose '[Your App name][C/C++ Application]gdb' entry, and then you can type gdb instruction(i.e. print this) in Console View.
It is possible to write in the console window and gdb answers. (You have to choose the right console window from the chooser in the top right edge of the console view).
Unfortunately the console is quite limited: gdb answers to command, but important features like tab-completion do not work.
Window > Show view > "Debugger Console" is the right way as of Eclipse CDT 4.7.0.
You can then type certain commands like print on the console and they will be evaluated.
Other more "active" commands like continue have no effect however.
Mentioned on this comment.

Eclipse - Running programs not in the native eclipse console

I'm currently writing some ncurses code and the native Eclipse (3.2.2) console can't display its graphics. I'd instead like to run the program through xterm. What I want is to be able to start xterm and run from there. I'd prefer to not get involved with any plugins or that jazz. Just something simple.
EDIT
So I have the answer and it was pretty simple...
Run -> External Tools -> External Tools -> New Launch Config...
Then select location of your terminal emulator. /usr/bin/gnome-terminal in my case.
after that set the appropriate arguments. "-e ~/ncurses/start" in my case.
Then make sure you aren't allocating a console by unchecking that option in the "Common" tab.
Annon add to his question:
its a pain to keep switching back and forth from eclipse and the terminal. I'm looking for a way to just hit something like"F5" and have it run my ncurses program in a new xterm terminal process
The simplest way to do that is to report the command line into an external tool configuration, and point eclipse to use a shell (like described in this program)
In the argument, you will add the command line eclipse execute (command line which can be retrieved as mentioned in the second part of this answer below).
Of course, replace 'cmd.exe' by the shell of your choice, and try not setting the 'Allocate Console' checkbox in the Common tab of that external launcher.
To launch through a xterm, without eclipse involved (not what you are asking for, just keep here for archive)
You can launch your program through Eclipse (Run Configurations), and observe through a 'ps' command the exact Java command line used.
Or launch it in debug mode, and right click the task in Debug view and open Properties. It will show the command line, as documented here.
Then launch that command line directly in your console (Eclipse being not involved at all at this point).