Automatically Terminating Previously Running Python Interprets when Relaunching in Eclipse - eclipse

Is there an option for the Eclipse plugin Pydev which would cause Pydev to automatically terminate any already running python instances when a new python instance is launched?
There is an option in Preferences --> Run/Debug --> General Options --> Remove terminated launches when new launches are created
I would need an option of the type: "Terminate and Remove all launches when new launches are created"

Sort of...
you can do the following: do a regular launch and take a look at the buttons in the PyDev console. There are options to terminate all launches, and to relaunch the last launch terminating the current one -- the shortcuts appear if you hover over the buttons:
So (provided you have focus on a PyDev editor):
terminate all launches: Ctrl+Alt+F9
terminate current and relaunch it: Ctrl+Shift+F9
Not exactly what you want, but I think it's the closer it gets right now...

Related

Handle the click on the Terminate button of an Eclipse's console?

Using Eclipse, I'm launching an external program through an "External Tool Configuration".
My program has a "bin/launch-program" executable, but also a "bin/stop-program" which is the only way to stop the program.
In my Eclipse's External Tool Configuration, tab "Main", I set:
Location: <PROGRAM_HOME>/bin/launch-program
Working Directory: <PROGRAM_HOME>
But I'm looking a way to handle the stop event.
In other words, launching an external program works well: I get the output in the Eclipse's console. The question is: how to handle the click on the Terminate button of the console, to launch a specific command line?
terminating the program from the terminate button of the eclipse console is equivalent to kill it by using a task manager.
It's not safe to edit the command on the red terminate button, but you can make the program to do things before exiting
shutdown hook

How to configure Eclipse to always launch the last run configuration, not the current file?

Back in 2008, around version 3.4, Eclipse changed the default behavior of the Run button to attempt to launch the file with focus, rather than launching the same run configuration that was run the last time. How do I get the old behavior back?
According to a post on Loving Software Blog, you change the following preference:
Run/Debug -> Launching panel; Launch Operation section; change radio button to "Always launch the previously launched application".
I've verified that this works in Indigo, the current version.

How to stop/disable PyUnit when using PyDev

I would like to have PyUnit stop showing up each time I hit CtrlF11. It's distracting and I don't understand it's output anyways, nor did I (knowingly) elect to enable it. I can't find anything in PyDev settings.
Ctrl + F11 has actually nothing to do with PyUnit. It is a key binding that per default runs the script you last launched. In your case the last launch you made must have been a PyUnit launch. If you would have launched the script with Run As then this would be launched if you press Ctrl + F11.
This could be a possible solution to your problem:
Remove the PyUnit launcher from Run History (Run -> Run Configurations and then delete the the configurations listed below Python unittest.
Hope that helped!
Cherio Woltan
Actually, in the PyDev > PyUnit settings (in the same screen you've shown), if you uncheck the 'show the results in the unittest results view', it should do what you want (i.e.: stop showing the PyUnit view)... or that's not what you wanted?

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.

Eclipse + pydev - Missing Console-view toolbar in minimized mode

I'm using Eclipse + pydev plugin as the development environment. In fact my application needs a big console area and I usually resize the console and minimize it, so that whenever I run the application, it automatically shows up.
But when I minimize the console view or detach it or mark it as Fast View, the toolbar for controlling the running process and locking the scroll disappears.
Can I have both minimize functionality and Process control toolbar ?
Eclipse : Galileo Build id: 20090619-0625
Pydev : 1.5.3
Right now, in Eclipse/PyDev, you can't have the toolbar when it's minimized (you have to open it to access it), but most of what you need should be available through shortcuts (some may need focus on a PyDev editor):
Terminate current process: Ctrl+F2
Terminate all processes: Ctrl+Alt+F9
Terminate / relaunch last launched process: Ctrl+Shift+F9
To launch the currently open editor: F9
To relaunch the last launch (provided you followed the steps at: http://pydev.org/manual_101_run.html): Ctrl+F11
To debug the last launch: F11
To show the console view: Alt+Shift+Q, C
And if you want, you should be able to configure those in the keybindings (Ctrl+Shift+L twice to open the preferences page to do so).
I used eclipse with pydev and it drove me nuts. I use Netbeans 6.8 right now which came bundled with its own python plugin that is a lot better. Especially when it comes to debugging.