[bugfix] Metadata object did not find inventory for relative directory paths/unescaped backslashes

This commit is contained in:
Marcel Paffrath 2024-08-29 16:34:37 +02:00
parent c765e7c66b
commit 5971508cab

View File

@ -27,6 +27,10 @@ class Metadata(object):
# saves which metadata files are from obspy dmt
self.obspy_dmt_invs = []
if inventory:
# make sure that no accidental backslashes mess up the path
if isinstance(inventory, str):
inventory = inventory.replace('\\', '/')
inventory = os.path.abspath(inventory)
if os.path.isdir(inventory):
self.add_inventory(inventory)
if os.path.isfile(inventory):