11

I'm doing a Python project in Eclipse with PyDev. I have a "main" file and some "class" files. I primarily work in the classes, but I need to execute the code via the main file.

At the moment I need to either switch to the main file, or use the drop down menu of the run/debug-button to execute the main file. Pressing the button or using F11, just runs the class file (which is useless)

Is there a way to let PyDev always run a specific file in a project, or perhaps always run the last file executed (which probably will be the best solution).

Thanks in Advance :)

Tobber
  • 7,211
  • 8
  • 33
  • 56

1 Answers1

13

Surely (relaunching the last launch was actually the default in in Eclipse 3.2, never understood why they changed that)...

You can have that back in the preferences at: window > preferences > Run/Debug > Launching and set the Launch Operation to Always launch the previously launched application.

So, Ctrl+F11 will relaunch the last launch and F11 will debug the last launch...

And to launch the file initially you may:

  • Use a shortcut: F9 to run the current opened file
  • Go to the menu: Alt + R + S + The number of the Run you wish (It can be Python, Jython, unit-test, etc).
  • If you are using unit-tests, you could use: Ctrl+F9 to run the unit-tests from the current module (and even selecting which tests should be run).
  • Relaunch some other launch you did previously: Alt + R + T and choose a previous launch to relaunch.
  • You may also launch in unit-test mode all files beneath a folder by right clicking the folder > run as > Python unit-test

(reference: http://pydev.org/manual_101_run.html)

And if you use unit-tests, you may also want to take a look at: Continuous unit testing with Pydev (Python and Eclipse)

Community
  • 1
  • 1
Fabio Zadrozny
  • 24,814
  • 4
  • 66
  • 78