From 5a78c9f7b6409facb93dcaf70e7802506b8a8bec Mon Sep 17 00:00:00 2001 From: Andi Gerken <andi.gerken@gmail.com> Date: Mon, 14 Feb 2022 21:43:20 +0100 Subject: [PATCH] Fixed error message when wrong paths are given to evaluation. --- src/robofish/io/io.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/robofish/io/io.py b/src/robofish/io/io.py index 763779b..7645a44 100644 --- a/src/robofish/io/io.py +++ b/src/robofish/io/io.py @@ -49,6 +49,10 @@ def read_multiple_files( sf_dict = {} for path in paths: + assert ( + path is not None and path.exists() + ), f"Path does not exists {path.resolve()}." + if path.is_dir(): logging.info("found dir %s" % path) # Find all hdf5 files in folder @@ -65,9 +69,12 @@ def read_multiple_files( ) if max_files is not None and len(sf_dict) >= max_files: break - elif path is not None and path.exists(): + else: logging.info("found file %s" % path) sf_dict[path] = robofish.io.File(path=path, strict_validate=strict_validate) + + assert len(sf_dict) > 0, f"No files found in given Paths. {paths}" + return sf_dict -- GitLab