简体   繁体   中英

Why does python 3 tell me that there is no such file or directory when I use test.json in my code

I am making a list app with my friend. When I try running the code, it comes up with this error:

Traceback (most recent call last):
  File "C:\Users\ellio_6\Desktop\Coding\Python\Programs\To-Do App\TeaTasksFuncs.py", line 75, in <module>
    TaskManager()()
  File "C:\Users\ellio_6\Desktop\Coding\Python\Programs\To-Do App\TeaTasksFuncs.py", line 6, in __init__
    self.tasks, self.task_number = self.read_data("test.json")
  File "C:\Users\ellio_6\Desktop\Coding\Python\Programs\To-Do App\TeaTasksFuncs.py", line 60, in read_data
    with open(file_path,"r+") as file:
FileNotFoundError: [Errno 2] No such file or directory: 'test.json'

please make sure that file that you are running your code from is in the same folder as test.json file. Otherwise give it a full path to the file.

I had to check a different file which was part of that program and I forgot to create the file in the python code in the other file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM