0

I tried using a file '.txt' located in the same folder as the '.py' file which is supposed to manipulate it and it never works just with the filename and extension in python 3.8. I am on windows 10 pro.

I am just sharing maybe you could go through the same.

Carlos Pimentel
  • 381
  • 5
  • 11
  • This is usually not a problem. You should add a code sample for completeness, and perhaps an image or text of the exact error? What IDE are you using? It may be something to be configured in that, with a known solution. Try Thonny and see if the problem still happens. It may even be something relative to this: https://stackoverflow.com/questions/40416072/reading-file-using-relative-path-in-python-project – srattigan Feb 24 '21 at 18:05

1 Answers1

0

I have to use the absolute path all the time, which is the only working approach i.e: ('C:\Users\Carlos\alice.txt'). Make sure to use the double backslashes otherwise you get an error for the escape character in windows.

Carlos Pimentel
  • 381
  • 5
  • 11