Last Site Update: 02 October 2008 | Latest Version: 1.3.22


Main

Download

Buy

License

Manual

About/Contact




Previous (Creating a module) Root Next (Configuring Eclipse)


Ok, now that you're already up and running with Pydev Extensions, 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 for Python run or Ctrl+F9 for Jython run.
  • Go to the menu: Alt + R + S + The number of the Run you wish (It can be Python, Jython, unit-test, etc).

NOTE: You can only run files that are in your project (so, you cannot run an external file -- this is an Eclipse limitation, and there are currently no ways of overcoming it).



Doing so, 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, 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.

First, you'll need to add a breakpoint in the "print 'Hello World'" line. To do so, go to the line and type Ctrl+F10 and select 'Add breakpoint', then type F11. 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

After the debug session, you can return to the previous perspective by typing '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.



Previous (Creating a module) Root Next (Configuring Eclipse)

© Copyright: Aptana, Inc. 2008