I'm trying to load the json file but it gives me an error saying No such file or directory:
with open ('folder1/sub1/sub2/sub2/sub3/file.json') as f:
data = json.load(f)
print data
The above file main.py is kept outside the folder1. All of this is kept under project folder.
So, the directory structure is Project/folder1/sub1/sub2/sub2/sub3/file.json Where am I going wrong?
'folder1/...'but not'/folder1/...'? And what's your current dir where you execute themain.pymain.pyfile is kept underprojectfoldermain.py, If it not under theProject, the real path offifyour_current_dir + '/folder1/...'but notProject/folder1/sub1/sub2/sub2/sub3/file.json