From 2963be5bba79de020fb4f5152ee521f55bfdeaec Mon Sep 17 00:00:00 2001 From: Marcel Date: Fri, 23 Aug 2019 11:29:15 +0200 Subject: [PATCH] [bugfix] try and error reading did not work for StationXML files --- pylot/core/util/dataprocessing.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pylot/core/util/dataprocessing.py b/pylot/core/util/dataprocessing.py index 3eb2007f..9ad4ccb2 100644 --- a/pylot/core/util/dataprocessing.py +++ b/pylot/core/util/dataprocessing.py @@ -301,9 +301,15 @@ class Metadata(object): return file_ending, robj # in case file endings did not match the above keys, try and error for file_type in ['dless', 'xml']: - robj, exc = read_functions[file_type](path_to_inventory_filename) - if exc is None: - return file_type, robj + try: + robj, exc = read_functions[file_type](path_to_inventory_filename) + if exc is None: + if self.verbosity: + print('Read file {} as {}'.format(path_to_inventory_filename, file_type)) + return file_type, robj + except Exception as e: + if self.verbosity: + print('Could not read file {} as {}'.format(path_to_inventory_filename, file_type)) return None, None @staticmethod