From a36da99ccb97c037e1cd13471cc5af85494a4704 Mon Sep 17 00:00:00 2001 From: junos Date: Wed, 12 Apr 2023 16:37:25 +0200 Subject: [PATCH] Catch another possible exception. --- src/data/streams/empatica_zip/container.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/data/streams/empatica_zip/container.py b/src/data/streams/empatica_zip/container.py index 8991b991..9fa183e1 100644 --- a/src/data/streams/empatica_zip/container.py +++ b/src/data/streams/empatica_zip/container.py @@ -136,8 +136,9 @@ def patch_ibi_with_bvp(ibi_data, bvp_data): # Begin with the cr-features part try: ibi_data, ibi_start_timestamp = empatica2d_to_array(ibi_data_file) - except IndexError as e: + except (IndexError, KeyError) as e: # Checks whether IBI.csv is empty + # It may raise a KeyError if df is empty here: startTimeStamp = df.time[0] df_test = pd.read_csv(ibi_data_file, names=['timings', 'inter_beat_interval'], header=None) if df_test.empty: df_test['timestamp'] = df_test['timings']