From: W. Trevor King Date: Fri, 2 Mar 2012 18:42:01 +0000 (-0500) Subject: Log useful debugging info when you can't read a data value. X-Git-Tag: v0.2~16 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4457044b4f0e465a390c668cc0dfb945be4d9792;p=h5config.git 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. --- 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