Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm. Getting the Project Dir in the "Run/Debug Configuration" Window

I want to share PyCharm run/debug configurations with my team. I need a way of configure run/debug configurations so they can work also in other computers.

Is there a dynamic way of getting the project's dir? Any ideas?

Perhaps a way to change say "C:\PythonPlatform\Test\" to something like "${PROJECT_DIR}\Test" in the "Folders" and "Working directory" fields? See the image:

enter image description here

like image 836
El Marce Avatar asked Nov 11 '13 17:11

El Marce


People also ask

Where are run configurations stored in PyCharm?

However, if you do not want to share the . idea directory, you can save the configuration to any other directory within the project. By default, it is disabled, and PyCharm stores run configuration settings in . idea/workspace.

How do I fix PyCharm configuration?

From the main menu, select File | Manage IDE Settings | Restore Default Settings. Alternatively, press Shift twice and type Restore default settings . Click Restore and Restart. The IDE will be restarted with the default configuration.


1 Answers

There are so called Macros in PyCharm which include $ProjectFileDir$ described as The directory of the project file. However it seems they can only be used in External Tools section and not in Run/Debug Configurations. However, there's very relevant issue titled Add support for macros in Run/Debug Configurations screen raised in another JetBrains' product — WebStorm. There, we find information that the path to any file underneath project's directory is stored relatively to the project's directory meaning that if the project is placed somewhere else in the filesystem the file would still be found. In other words paths you see are presented as absolute paths but they are in fact relative to the project's directory. I must admit it's confusing to say the least.

I created issue Add support for macros in run/debug configurations — feel free to vote on it.

like image 184
Piotr Dobrogost Avatar answered Oct 12 '22 12:10

Piotr Dobrogost