I have a file in the 'data' folder, but when I run my script, Python says it doesn't exist.
I'm using:
open('./data/config.json')
How do I fix this relative path issue?
Solution I found:
Using an absolute path based on the script location solved it.
Full example with terminal log:
https://github.com/go2maxi/common-python-errors/tree/main/os-filenotfounderror-wrong-relative-path
I have a file in the 'data' folder, but when I run my script, Python says it doesn't exist.
I'm using:
open('./data/config.json')
How do I fix this relative path issue?
Solution I found:
Using an absolute path based on the script location solved it.
Full example with terminal log:
https://github.com/go2maxi/common-python-errors/tree/main/os-filenotfounderror-wrong-relative-path