Last Site Update: April 18th, 2024 | Latest Version: 12.0.0







PyDev LiClipse

Previous (Module Creation) Root Next (Configuring Eclipse)

Ok, now that you're already up and running, let's run a program from within Eclipse with PyDev.

For that, we will extend the module we created in the previous chapter with the following program:

if __name__ == '__main__':
    print('Hello World')

Then, to run the file you can:

  • Use a shortcut: F9 to run the open editor based on the project configuration where the module is contained (or for debug mode Shift+F9).
  • Go to the menu: Alt + R + S + The number of the Run you wish (It can be Python, Jython, unit-test, etc).
  • Note: if you were using unit-tests, you could use: Ctrl+F9 to run the unit-tests from the module (and even selecting which tests should be run -- and if Shift is pressed it's launched in debug mode).
    • Tip: you may want to pre-select the test to be run in the editor (with Ctrl+Shift+Up or Ctrl+Shift+Down) so that Ctrl+F9 will have that test pre-selected to run.


External files may be launched, but an associated project must be available. So, a file may be dragged from the filesystem into Eclipse and later, with the editor open F9 may be pressed to run the file...

It'll still ask for a project to resolve the PYTHONPATH and interpreter to be used (you can probably just use any project you have that has the interpreter you want to use for the run or create a PyDev project as 'external_projects' and bind those runs to it).

-- The configuration created may be changed later on in the menu: Run > Run Configurations.

By launching a file, the console should be brough forward with the output of the code (if you had some exception raised, clicking on it would bring you to the code in the stack-trace).

After the first run, using Ctrl+F11, the last file should be re-run. Or, if you type just F11, a debug session is started with your last run.

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.

Now, let's go on to starting a debug session. First, you'll need to add a breakpoint in the print('Hello World') line. To do so, go to that line, use Ctrl+F10 and select 'Add breakpoint' (or double-click the left ruler), then use the F11 to re-run the last launch. Doing so, will trigger you to go to the debug perspective. You should say yes to this dialog.

After saying yes, you should be brought to the perspective below.

In this perspective, the debug actions are activated and presented to
you, so, you can use:

F5: Step into

F6: Step over

F7: Step return

F8: Resume execution

Ctrl+Shift+B: Toggle Breakpoints

Ctrl+Alt+R: Set Next Statement (so, in the example above, you could set the if __name__ == "__main__" as the next line to be executed).

Use line prefixed with >>> in the console to evaluate expressions.

After the debug session, you can return to the previous perspective by using Ctrl+F8 (this keybinding iterates through the open perspectives)... And while we are at it, Ctrl+F7 iterates through the views and Ctrl+F6 iterates through the editors.

Note: you can also add those actions to other perspectives by customizing the perspective (in Window > Perspective > > Customize Perspective ... > Action Set availability enable the Breakpoints and Debug options)

Previous (Module Creation) Root Next (Configuring Eclipse)

PyDev development

PyDev is open source and depends on your contributions! This may be in the form of bug fixes, answers on stackoverflow, new features...

Another option is financially supporting it at: Patreon (which provides a way to support it monthly and get rewards starting with $1).

Or through 1-time contributions at:


Search PyDev-related content

Copyright: Brainwy Software Ltda, 2014-2021