From 1e892bfb0519e6070c45d6f5b8338cc9f268c899 Mon Sep 17 00:00:00 2001 From: Tom Viner Date: Mon, 3 Apr 2023 00:07:18 +0100 Subject: [PATCH 1/5] don't depend on the path script is run from --- scripts/data.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/data.py b/scripts/data.py index 194735578..62a36e125 100644 --- a/scripts/data.py +++ b/scripts/data.py @@ -1,7 +1,12 @@ +from pathlib import Path + +FOLDER = Path(__file__).parent + + def load_prompt(): try: # 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() return prompt From 4c66cd6f4a4e81aee56a87a1331ba7f92b70857c Mon Sep 17 00:00:00 2001 From: Toran Bruce Richards Date: Tue, 4 Apr 2023 10:00:40 +0100 Subject: [PATCH 2/5] Renames FOLDER to SRC_DIR --- scripts/data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/data.py b/scripts/data.py index 62a36e125..f4d6eb0e5 100644 --- a/scripts/data.py +++ b/scripts/data.py @@ -1,6 +1,6 @@ from pathlib import Path -FOLDER = Path(__file__).parent +SRC_DIR = Path(__file__).parent def load_prompt(): From 6d86444b6f67d853e6ce31015c0d179169896ade Mon Sep 17 00:00:00 2001 From: Toran Bruce Richards Date: Tue, 4 Apr 2023 10:00:53 +0100 Subject: [PATCH 3/5] Renames FOLDER to SRC_DIR --- scripts/data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/data.py b/scripts/data.py index f4d6eb0e5..bb4b296e4 100644 --- a/scripts/data.py +++ b/scripts/data.py @@ -6,7 +6,7 @@ SRC_DIR = Path(__file__).parent def load_prompt(): try: # Load the promt from data/prompt.txt - with open(FOLDER / "data/prompt.txt", "r") as prompt_file: + with open(SRC_DIR/ "data/prompt.txt", "r") as prompt_file: prompt = prompt_file.read() return prompt From 8b3c2fee2e7530fb77f5493fffa6cc9c4918508d Mon Sep 17 00:00:00 2001 From: Toran Bruce Richards Date: Tue, 4 Apr 2023 10:03:30 +0100 Subject: [PATCH 4/5] Update scripts/data.py --- scripts/data.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/data.py b/scripts/data.py index 7969d69c3..a6ffdadf0 100644 --- a/scripts/data.py +++ b/scripts/data.py @@ -11,7 +11,6 @@ def load_prompt(): # Load the promt from data/prompt.txt with open(SRC_DIR/ "data/prompt.txt", "r") as prompt_file: - prompt = prompt_file.read() return prompt From 4d4ff658abceeb5b38a2fe8dc43ce2749d82cf4a Mon Sep 17 00:00:00 2001 From: Toran Bruce Richards Date: Tue, 4 Apr 2023 10:04:02 +0100 Subject: [PATCH 5/5] Update scripts/data.py --- scripts/data.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/data.py b/scripts/data.py index a6ffdadf0..72a6bbfc6 100644 --- a/scripts/data.py +++ b/scripts/data.py @@ -9,7 +9,6 @@ def load_prompt(): data_dir = file_dir / "data" prompt_file = data_dir / "prompt.txt" # Load the promt from data/prompt.txt - with open(SRC_DIR/ "data/prompt.txt", "r") as prompt_file: prompt = prompt_file.read()