I'm using Pycharm on OS X.
The structure is:
/Project
/src
codeA.py
codeB.py
/Data
data.txt
src
is marked as Sources Root and Data
is marked as Resource root.
The problem is if I write in codeA.py
import codeB
with open("./Data/data.txt",'r'):
pass
If I
Execute code line by line in console, the file can be found.
Execute by clicking "Run code.py" I'll get No Such File error.
Execute codeA.py in terminal, I can not even import codeB.
If I write ../Data/data.txt
instead, then method 2 can run but method 1 will get No Such File Error.
I've checked project interpreter path and console path. They are the same.
Any idea to solve this problem?