This is my file tree:
run.py
foo/
file.py
foo.json
In file.py
there is the following code:
import json
print(json.load(open('foo.json')))
In run.py
there is the following code:
import foo.foo as foo
When running run.py
I get the following error:
Traceback (most recent call last):
File "run.py", line 1, in <module>
import foo.foo as foo
File "C:\Users\user\Desktop\foo\foo.py", line 3, in <module>
print(json.load(open('foo.json')))
FileNotFoundError: [Errno 2] No such file or directory: 'foo.json'
How do I run run.py
without getting that error and without run.py
being in the same directory. Any help is appreciated!