简体   繁体   中英

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:

在此输入图像描述

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM