From aea9ac72c49512ee1f6a92a823b9060d661a1f2a Mon Sep 17 00:00:00 2001 From: BoYanZh Date: Sun, 20 Oct 2024 16:48:38 -0400 Subject: [PATCH] feat: create path on not exist --- joint_teapot/utils/joj3.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/joint_teapot/utils/joj3.py b/joint_teapot/utils/joj3.py index 99372fd..d49690a 100644 --- a/joint_teapot/utils/joj3.py +++ b/joint_teapot/utils/joj3.py @@ -16,7 +16,7 @@ def generate_scoreboard( f"Scoreboard file should be a .csv file, but now it is {scoreboard_file_path}" ) return - + os.makedirs(os.path.dirname(scoreboard_file_path), exist_ok=True) # Load the csv file if it already exists if os.path.exists(scoreboard_file_path): with open(scoreboard_file_path, newline="") as file: @@ -150,6 +150,7 @@ def write_failed_table_into_file(data: List[List[str]], table_file_path: str) -> for row in data: text += f"|{row[0]}|{row[1]}|{row[2]}|\n" + os.makedirs(os.path.dirname(table_file_path), exist_ok=True) with open(table_file_path, "w") as table_file: table_file.write(text)