don't depend on the path script is run from

This commit is contained in:
Tom Viner
2023-04-03 00:07:18 +01:00
parent 64af11f4ab
commit 1e892bfb05

View File

@@ -1,7 +1,12 @@
from pathlib import Path
FOLDER = Path(__file__).parent
def load_prompt(): def load_prompt():
try: try:
# Load the promt from data/prompt.txt # Load the promt from data/prompt.txt
with open("data/prompt.txt", "r") as prompt_file: with open(FOLDER / "data/prompt.txt", "r") as prompt_file:
prompt = prompt_file.read() prompt = prompt_file.read()
return prompt return prompt