Python

Python resources

PyCharm know how’s

Set python interpreter

figure
Note: In this example the dtk environment is called venv

Run script from terminal

figure
Tip: Use the tab key to autocomplete the name of the file while typing

The program used in the terminal is often per default cmd.exe. If this needs to be changed (i.e. to powershell or vice versa) this can be achieved in File -> Settings -> Tools -> Terminal

figure

Run script from pycharm

figure

Run script interactively

figure
Note: Use the shortcut SHIFT+ALT+E (windows) to interactively send code to the python console

Tip: Running in interactive mode is helpful for debugging code, add print or error capturing statements to facilitate checking each step (as shown in running from pycharm)