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 t开发者_StackOverflow社区o 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.
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 theLaunch Operation
toAlways 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.
精彩评论