HDFGroup / h5pyd

h5py distributed - Python client library for HDF Rest API
Other
111 stars 39 forks source link

Internal Server Error when reading boolean values #24

Closed rayosborn closed 7 years ago

rayosborn commented 7 years ago

I have an HDF5 file that contains several datasets containing boolean values, both scalar and arrays, along with many other datasets and groups. Trying to read these using h5pyd returns an Internal Server Error, which doesn't seem to happen with datasets of other types. Here is a trace:

>>> import h5pyd as h5
>>> a=h5.File('mullite_300K.mullite.exfac', mode='r', endpoint='http://some.server:5000')
>>> a['/f1/instrument/detector/pixel_mask']
---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-16-2a29cb1cdcaa> in <module>()
----> 1 a['/f1/instrument/detector/pixel_mask_applied']

/Users/rosborn/anaconda/envs/py27/lib/python2.7/site-packages/h5pyd/_hl/group.pyc in __getitem__(self, name)
    314         if link_class == 'H5L_TYPE_HARD':
    315             #print "hard link, collection:", link_json['collection']
--> 316             tgt = getObjByUuid(link_json['collection'], link_json['id'])
    317         elif link_class == 'H5L_TYPE_SOFT':
    318             h5path = link_json['h5path']

/Users/rosborn/anaconda/envs/py27/lib/python2.7/site-packages/h5pyd/_hl/group.pyc in getObjByUuid(collection_type, uuid)
    287             elif link_json['collection'] == 'datasets':
    288                 req = "/datasets/" + uuid
--> 289                 dataset_json = self.GET(req)
    290                 tgt = Dataset(DatasetID(self, dataset_json))
    291             else:

/Users/rosborn/anaconda/envs/py27/lib/python2.7/site-packages/h5pyd/_hl/base.pyc in GET(self, req, format)
    522 
    523         if rsp.status_code != 200:
--> 524             raise IOError(rsp.reason)
    525         if rsp.headers['Content-Type'] == "application/octet-stream":
    526             self.log.info("returning binary content, length: " +

IOError: Internal Server Error
jreadey commented 7 years ago

@rayosborn - can you make this file available for me to download?

rayosborn commented 7 years ago

I have sent you a link to an online server, which I hope you can access.

jreadey commented 7 years ago

I got the file and can reproduce the error.

The HDF5 library doesn't directly support boolean types, but I think h5py emulates it as an enum type. Should be easy to add to h5pyd.

jreadey commented 7 years ago

I've got a fix in this commit: https://github.com/HDFGroup/h5pyd/commit/80b43b46fddd6630b6f50c77f3cb93723213cce0.

There are also downstream changes in h5serv and hdf5-json. You'll want to pick up the last checkins from those repos, do a "python setup.py install" in hdf5-json, and restart h5serv.

Let me know if this works for you.

rayosborn commented 7 years ago

This works. I was able to read both boolean entries without any problem.