When I use no path for ex.
filename = 'cats.txt'
with open(filename) as f:
contents = f.read()
print(contents)
When I execute this code I receive a filenotfound error even though this file is in the same location as the currently running Python file. The only way this works is if I use an absolute path, which is really annoying when I'm working with a sizable list of filenames.
Anyone know the reason why this is happening? I also receive a similar error when writing to a brand new file, it doesn't save into the location of my currently running python file, but to my user location on PC and not any folder further. Very weird.