From a9e73d2aa87d45e65cbaf9598ddcff278ba80ae5 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 1 Apr 2024 07:24:46 -0500 Subject: Getting Rqtl to run on fallback --- gn3/fs_helpers.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gn3/fs_helpers.py b/gn3/fs_helpers.py index 74e7ada..845c48b 100644 --- a/gn3/fs_helpers.py +++ b/gn3/fs_helpers.py @@ -13,14 +13,19 @@ from typing import List from typing import ValuesView from werkzeug.utils import secure_filename +def assert_path_exists(path: str, throw_error: bool = True) -> bool: + """Throw error if any of them do not exist.""" + if not os.path.isfile(path): + if throw_error: + raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), path) + else: + return False + return True + def assert_paths_exist(paths: ValuesView, throw_error: bool = True) -> bool: """Given a list of PATHS, throw error if any of them do not exist.""" for path in paths: - if not os.path.isfile(path): - if throw_error: - raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), path) - else: - return False + assert_path_exists(path,throw_error) return True def get_hash_of_files(files: List[str]) -> str: -- cgit v1.2.3