"""HDF5 backend implementation
"""
+import os.path as _os_path
import types as _types
import h5py as _h5py
print pformat_HDF5(*args, **kwargs)
def pformat_HDF5(filename, group='/'):
- with _h5py.File(filename, 'r') as f:
- cwg = f[group]
- ret = '\n'.join(_pformat_hdf5(cwg))
+ try:
+ with _h5py.File(filename, 'r') as f:
+ cwg = f[group]
+ ret = '\n'.join(_pformat_hdf5(cwg))
+ except IOError, e:
+ if 'unable to open' in e.message:
+ if _os_path.getsize(filename) == 0:
+ return 'EMPTY'
+ return None
+ raise
return ret
def _pformat_hdf5(cwg, depth=0):