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

Time:09-03

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'

CodePudding user response:

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.

CodePudding user response:

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.

  • Related