I have created an executable file of a python script that uses a text file a.txt. I have created a one file executable using the script file bot.py and the text file a.txt together. However, the executable only works when it is in the same folder as bot.py and a.txt files. If it is in a folder without these two files it doesn't work and throws an error.
My code:
subs = []
with open("a.txt") as file:
for line in file:
if line != "\n":
x = line.strip()
subs.append(x)
What can I do to make sure that it works even when the original 2 files are not present?
This is my first post here, so sorry if its not very concise. Thanks in advance