PyCharm current working directory

前端 未结 8 1433

Recently, I\'m unable to use relative paths in my code while using PyCharm. For instance, a simple open(\'test.txt\', \'r\') will not work - whereupon I am sure

8条回答
  •  忘掉有多难
    2020-11-28 08:31

    Current version 2019.2 somehow ignores "source root" from the "project structure". Here's how to actually enforce it:

    Run -> Edit Configurations -> Python -> "Edit Templates" -> fill out "Working Directory"

提交回复
热议问题