PyCharm current working directory

前端 未结 8 1426

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:46

    I have Pycharm 4.5, so things might have changed a bit.

    Try going to Settings > Project > Project Structure

    On this dialog, click your folder that has the source code in it, and then click the blue folder in the menu to note it as "source" folder. I believe this fixes a lot of the path issues in Pycharm

    Here is the link to "content roots": https://www.jetbrains.com/pycharm/help/content-root.html

提交回复
热议问题