Jul-02-2017, 03:42 PM
Ok so I'm getting an error when I am trying to access a file on my computer. I'm using the python shell and version is 3.6.1 All I want to do with the file is be able to read and write to it. The file I am trying to access is under the folder "My documents". I'm on Windows OS. My code is as follows:
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
newfile = open("testfile2", "r")
FileNotFoundError: [Errno 2] No such file or directory: 'testfile2'
I don't understand why I am getting this error as the name of the file is not mispelled in the code. If you can provide help could you please explain what I was doing wrong and what I should do to fix it. :)
newfile = open("testfile2", "r")The error I am getting is as follows:
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
newfile = open("testfile2", "r")
FileNotFoundError: [Errno 2] No such file or directory: 'testfile2'
I don't understand why I am getting this error as the name of the file is not mispelled in the code. If you can provide help could you please explain what I was doing wrong and what I should do to fix it. :)