From d8167dd9be2c5f153844d0af8d7cd39f2ae1b954 Mon Sep 17 00:00:00 2001
From: Florian Atteneder <florian.atteneder@uni-jena.de>
Date: Mon, 11 Dec 2023 15:38:59 +0100
Subject: [PATCH] gracefully handle failed parsing of core waveform file

---
 watpy/utils/coreh5.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/watpy/utils/coreh5.py b/watpy/utils/coreh5.py
index 3967331..fe39b2c 100644
--- a/watpy/utils/coreh5.py
+++ b/watpy/utils/coreh5.py
@@ -107,8 +107,13 @@ class CoRe_h5(object):
 
                 # check this has some chances to be CoRe data
                 if '.txt' != os.path.splitext(f)[-1]: continue
-                vlmr = wfile_parse_name(f, 'core')
-                if vlmr == None: continue
+                if f.endswith('metadata.txt'): continue
+                try:
+                    vlmr = wfile_parse_name(f, 'core')
+                except Exception as ex:
+                    print(str(ex), f", skipping {f}")
+                    continue
+
                 var,l,m,r,c = vlmr
                 
                 if var == 'EJ':
-- 
GitLab