My current project tree:
redditbot/
-- commands/
----__init__.py
----comment_cache.txt
----readcomments.py
--mainbot.py
What I am attempting to do is read the comment_cache.txt file via open('comment_cache.txt')
in the readcomments.py file., but for some reason I am getting a FileNotFoundError. Even when I try print(os.path.isfile('comment_cache.txt'))
, it just returns false.
Am I making a beginner mistake here? Maybe something that just I keep missing?
EDIT: I appreciate all the answers/comments, but I believe it is a problem with my Python interpreter itself. I kept moving around the file between the redditbot/ directory and the commands/ package until it just started working. Also for some reason whenever I call print()
, PyCharm tells me that it is undefined...