I'm trying to read a file on a specific path with with open
method. Normally I do this with no problem, but right now there is a txt file on a specific path and Python raising FileNotFoundError
. I formatted the pc today, I don't know the problem is about this or not.
I added Python to path. Version is 3.5. I tried these lines at the beginning of file;
#!/usr/bin/env
import os
#!/usr/bin/env python
import os
#!/usr/bin/env python3
import os
none of this worked. Still got the error. How can I fix this error? Searched questions about this problem but there are no answer for me.
UPDATE AFTER COMMENTS
Full traceback is:
`File "C:\Users\windows\Desktop\go.py", line 4, in <module>
with open ("file") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'file'`
I'm trying to open this file with these codes;
with open ("file") as f:
t = f.readlines()
print (t)
The file is on the Desktop.