From 6531c6aa3d25220ef1ce68ad0d74adcabdc94e24 Mon Sep 17 00:00:00 2001 From: AlessioNar Date: Wed, 16 Oct 2024 13:26:50 +0200 Subject: [PATCH] Fixing the standard error marking the absence of a LOG file directory --- op_cellar/documents.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/op_cellar/documents.py b/op_cellar/documents.py index 8cc4c5f..339b50e 100644 --- a/op_cellar/documents.py +++ b/op_cellar/documents.py @@ -113,11 +113,14 @@ def download_documents(results, download_dir): Sends a REST query to the Publications Office APIs and downloads the Cellar documents """ cellar_ids = get_cellar_ids_from_json_results(results) + if not os.path.exists(LOG_DIR): + os.makedirs(LOG_DIR) + nthreads = 1 threads = [] for i in range(nthreads): sub_list = cellar_ids[i::nthreads] - t = threading.Thread(target=process_range, args=(sub_list, os.path.join(download_dir, str(i)))) + t = threading.Thread(target=process_range, args=(sub_list, os.path.join(download_dir, str(sub_list)))) threads.append(t) [t.start() for t in threads] [t.join() for t in threads]