I am trying to open JSON file which is located in another directory, and receiving error:
FileNotFoundError: [Errno 2] No such file or directory:
I understand that if I provide relative path, the file has to be in same directory, otherwise the full (root) path has to be provided.
My question is how to avoid it, as at the moment I test it locally, but the code is being used by other people so obviously the path can't be from my root.
Any idea of how to resolve it?
Here is the code:
with open("example.json") as commands:
commands = json.load(commands)