From 973e3674daab1ccb6dfbd94d5b13c131f8a258bc Mon Sep 17 00:00:00 2001 From: Abdulkhalek Muhammad <124366787+Abdulkhalek-1@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:39:24 +0300 Subject: [PATCH] fix(ats): Ensure directory exists before attempting to remove old files (#290) - Added a check to verify if the directory exists in before attempting to list its contents. - If the directory does not exist, it is created to prevent errors during file removal. Co-authored-by: abdulkhalek --- run_first.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/run_first.py b/run_first.py index bebfd19c..776dca5a 100644 --- a/run_first.py +++ b/run_first.py @@ -18,6 +18,9 @@ def read_json(filename): def remove_old_files(files_path): + if not os.path.exists(files_path): # Check if the folder exists or not. + # Create the folder if it doesn't exist to avoid error in the next step. + os.makedirs(files_path) for filename in os.listdir(files_path): try: