From bea3d13ddad2273704fc7f08db2b38ee1db7bfdd Mon Sep 17 00:00:00 2001 From: David Hammer <dhammer@mailbox.org> Date: Tue, 27 Apr 2021 10:17:11 +0200 Subject: [PATCH] Fix case where mdata_const may be undefined --- src/cal_tools/tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cal_tools/tools.py b/src/cal_tools/tools.py index 551bb3e48..9daa4fa8b 100644 --- a/src/cal_tools/tools.py +++ b/src/cal_tools/tools.py @@ -398,7 +398,7 @@ def get_pdu_from_db(karabo_id: str, karabo_da: Union[str, list], :param karabo_id: Karabo identifier. :param karabo_da: Karabo data aggregator. - :param constant: Calibration constant object to + :param constant: Calibration constant object to intialize CalibrationConstantMetadata class. :param condition: Detector condition object to intialize CalibrationConstantMetadata class. @@ -548,8 +548,8 @@ def get_from_db(karabo_id: str, karabo_da: str, raise RuntimeError(f'{e}') if ntries > 0: + mdata_const = metadata.calibration_constant_version if load_data and meta_only: - mdata_const = metadata.calibration_constant_version fpath = Path(mdata_const.hdf5path, mdata_const.filename) with h5py.File(fpath, "r") as f: arr = f[f"{mdata_const.h5path}/data"][()] -- GitLab