From 4457044b4f0e465a390c668cc0dfb945be4d9792 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 2 Mar 2012 13:42:01 -0500 Subject: [PATCH] Log useful debugging info when you can't read a data value. Now you know the field that caused the problem. For example: Could not access /vibration/0/config/deflection/channel: 'ellipsis' object has no attribute 'encode' Is more informative than a traceback that doesn't mention the troublesome field. --- h5config/storage/hdf5.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/h5config/storage/hdf5.py b/h5config/storage/hdf5.py index f0a214f..238b9ba 100644 --- a/h5config/storage/hdf5.py +++ b/h5config/storage/hdf5.py @@ -183,7 +183,12 @@ class HDF5_Storage (_FileStorage): config[s.name] = s.config_class() self._load(config=config[s.name], group=cwg) else: - v = group[s.name][...] + try: + v = group[s.name][...] + except Exception, e: + _LOG.error('Could not access {}/{}: {}'.format( + group.name, s.name, e)) + raise if isinstance(v, _numpy.ndarray): if isinstance(s, _config.BooleanSetting): v = bool(v) # array(True, dtype=bool) -> True -- 2.26.2