I've been working on this Python project and just realized there's an issue. At first I thought it was just in Linux because I tried to create a command to open the file in the file path and then realized when it's ran anytime outside of the destination folder that it runs an error even in Windows. So it has to be an issue with my code in general. Basically I'm trying to call the program to read and print data from a text file.
help_text = open("files/help_text.txt","r")
help_text_content = help_text.read()
print(help_text_content)
All I want to do is make sure that it reads the file no matter where the .py
file is located. I can't do C:\Location
because if the user installs the file it might be located somewhere else. So I need an absolute location reader that knows where the file itself is.