From 4ead3f5bc1729772570563288527a8bf92b8825d Mon Sep 17 00:00:00 2001 From: Karim Ahmed <karim.ahmed@xfel.eu> Date: Wed, 13 May 2020 12:23:58 +0200 Subject: [PATCH] close h5file properly --- cal_tools/cal_tools/agipdlib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cal_tools/cal_tools/agipdlib.py b/cal_tools/cal_tools/agipdlib.py index 558ec084b..1ac77d9b8 100644 --- a/cal_tools/cal_tools/agipdlib.py +++ b/cal_tools/cal_tools/agipdlib.py @@ -1655,8 +1655,8 @@ class AgipdCorrections: for cname, mdata in const_yaml[dname].items(): when[cname] = mdata["creation-time"] if when[cname]: - cf = h5py.File(mdata["file-path"]) - cons_data[cname] = np.copy(cf[f"{dname}/{cname}/0/data"]) + with h5py.File(mdata["file-path"], "r") as cf: + cons_data[cname] = np.copy(cf[f"{dname}/{cname}/0/data"]) else: # Create empty constant using the list elements cons_data[cname] = \ -- GitLab