[bugfix] try and error reading did not work for StationXML files

This commit is contained in:
Marcel Paffrath 2019-08-23 11:29:15 +02:00
parent c1cb0e4a37
commit 2963be5bba

View File

@ -301,9 +301,15 @@ class Metadata(object):
return file_ending, robj return file_ending, robj
# in case file endings did not match the above keys, try and error # in case file endings did not match the above keys, try and error
for file_type in ['dless', 'xml']: for file_type in ['dless', 'xml']:
try:
robj, exc = read_functions[file_type](path_to_inventory_filename) robj, exc = read_functions[file_type](path_to_inventory_filename)
if exc is None: if exc is None:
if self.verbosity:
print('Read file {} as {}'.format(path_to_inventory_filename, file_type))
return file_type, robj 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 return None, None
@staticmethod @staticmethod