From 14aaf6bdc64371776a75d54edef0d1a681e25ef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com> Date: Fri, 29 Jan 2021 17:38:12 +0100 Subject: [PATCH] FIX: catch ValueError when reading include file --- src/caosadvancedtools/scifolder/withreadme.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/caosadvancedtools/scifolder/withreadme.py b/src/caosadvancedtools/scifolder/withreadme.py index c36fb736..8a63e1f6 100644 --- a/src/caosadvancedtools/scifolder/withreadme.py +++ b/src/caosadvancedtools/scifolder/withreadme.py @@ -261,10 +261,17 @@ class WithREADME(object): for item in self.header[field.key]: if INCLUDE.key in item: - included.extend( - get_entity_ids_from_include_file( - os.path.dirname(self.crawled_path), - item[INCLUDE.key])) + try: + included.extend( + get_entity_ids_from_include_file( + os.path.dirname(self.crawled_path), + item[INCLUDE.key])) + except ValueError: + al = logging.getLogger("caosadvancedtools") + al.warning("The include file cannot be read. Please " + "make sure, it contains an 'ID' column." + " The file is ignored." + "\n{}".format(item[INCLUDE.key])) assure_object_is_in_list(included, record, -- GitLab