Ipython in pydev interactive debugging console(eclipse) - pydev

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).

Related

How to inspect variables form interactive console in PyDev

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?

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.

Whats the shortcut to Debug in PyDev using Eclipse

The shortcut key is F11 to start debugging. But issue is that I have to be on that file and then hit F11 to start debugging.
Eg.
my file to launch the application is "launch.py" and "example.py".
example.py is open in the editor whereas launch.py is not.
Now, if I hit F11 it will try to launch the application using "example.py" and terminates due to error (as expected).
So then I have to open the "launch.py" in the editor and then hit F11 to start debugging the application.
Is there any neater way to configure the debugging, so that it starts the application in single hit/key?
Edit: example.py is some other file (some module). It does not launch the application.
As this PyDev Eclipse Tutorial suggests:
After the first run, if you type Ctrl+F11, the last file ran is re-run. Or, if you type just F11, a debug session is started with your last run. Let's test this...
Note: This behavior changed in Eclipse 3.3 -- but it's generally recommended to restore it in the preferences at: window > preferences > Run/Debug > Launching and set the Launch Operation to Always launch the previously launched application.
This tutorial will always consider this as the default option.
So, did you have this option selected?
If you have launch at least once launch.py, then you can re-launch it easily.
Although this isn't strictly an answer to what was asked initially, it might help someone looking here that had the same problem as me...
I'm a Java developer mainly, so have the Java view open almost all the time. However, sometimes I want to run some python file to test something (or just create a quick python script, and run it)...
In the Java editor, if the current class has a main(String[] args) method, I run it with (and popup the dialog to ask me what exactly I'd like to run in the middle)
alt+shift+x, j
Unfortunately, that doesn't work in the Python view, and I've not found a similar solution - it just asks me if I'd like to run it as a Java app... however, as the VonC says, you can run the last run thing (provided you've set the preferences accordingly) with
ctrl+f11
and this seems work well with python run configurations too.
But... What if the last thing I ran was a Java program, but I now want to run the active .py file? Previously, to run the .py file, I'd have to go digging through the buttons on the toolbar with the mouse, and I tend to prefer keyboard shortcuts...
Solution! So, finally I come to the actual useful bit of this answer - I just discovered by accident (typing Ivan's suggested shortcut, but missing!), it appears that
f9
will run the currently active python file.
Hope that helps someone get just that little bit faster...
I use CTRL+SHIFT+F9 to relaunch the previous debug configuration in Pydev.

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.

Strange behaviour of created *.exe

Has anyone any idea why the resulting exe from a build comes with a console?
I've built an EXE and it shows up with the window it should (the right one), and a console window (the left one - obviously).
alt text http://img216.imageshack.us/img216/570/strangep.jpg
This behaviour is the same for the debug - exe and the release - exe.
When I start it from Eclipse the console window does not show up.
(Eclipse Galileo / MinGW / C)
Find the linker settings, and add the -mwindows switch.
you might look into this here surely answers why Eclipse is not opening your console window
There seems to be no way to get a java.io.Console object when running an application through Eclipse. A command-line console window is not opened with the application, as it is run as a background process (background to Eclipse?). Currently, there is no Eclipse plugin to handle this issue, mainly due to the fact that java.io.Console is a final class.
All you can really do is test the returned Console object for null and proceed from there.
as far as your console window popping is concerned, you might be using System.console in the application
Hope this Helps