Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the default working directory for run configurations in PyCharm

When I want to run one of our many python scripts I hit run, which creates a new run configuration. The working directory for that configuration is the folder in which the python script file resides. Instead, it should run from a project wide fixed folder. I'd like to set that somehow but I really cannot figure out why, which is a bit odd as I'd expect many people to want to have this functionality. Do you know how to pull this off?

like image 861
ikku100 Avatar asked Oct 17 '16 14:10

ikku100


People also ask

How do I change the default working directory in PyCharm?

button in the submenu appearing when clicking on your currently selected run configuration in the top right of PyCharm, you are able to edit the fields (and therefore also the working directory) of Python run configurations by selecting Python from the Templates (also called Defaults in versions pre-2018) and ...

Where does PyCharm store run configurations?

By default, it is disabled, and PyCharm stores run configuration settings in . idea/workspace. xml.

How do I change the run configuration in PyCharm?

From the main menu, select Run | Edit Configurations. Alternatively, press Alt+Shift+F10 , then 0 . In the left-hand pane of the run/debug configuration dialog, click Edit configuration templates…. In the Run/Debug Configuration Templates dialog that opens, select a configuration type.

How do I change the working directory in PyCharm terminal?

Press Alt+Right and Alt+Left to switch between active tabs. Alternatively, you can press Alt+Down to see the list of all terminal tabs.


1 Answers

If you hit the Edit configurations... button in the submenu appearing when clicking on your currently selected run configuration in the top right of PyCharm, you are able to edit the fields (and therefore also the working directory) of Python run configurations by selecting Python from the Templates (also called Defaults in versions pre-2018) and specifying the desired values.

Don't forget to hit Apply/OK before creating new run configurations, which should now contain the default values you specified!

As far as I know, these defaults are local to one project. See also: https://www.jetbrains.com/help/pycharm/2016.2/creating-and-editing-run-debug-configurations.html

like image 124
mxscho Avatar answered Oct 02 '22 22:10

mxscho