Last Site Update: October 20th, 2024 | Latest Version: 12.2.0 |
|
|
|
|
|
|
|
|
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:
NOTE:
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.
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)
|
PyDev developmentPyDev 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: Paypal Search PyDev-related content |
|
|
Copyright: Brainwy Software Ltda, 2014-2021 |