Python 尝试访问h5py.Dataset中的对象时出现不变的Segfault

Python 尝试访问h5py.Dataset中的对象时出现不变的Segfault,python,hdf5,h5py,Python,Hdf5,H5py,我想知道通过h5py访问数据是否有任何特殊限制?我期望从相关数据集中得到一个包含内部数组的数组 我可以将对象加载到内存中,访问数据文件中的大部分键 >>> import h5py >>> fileobj = h5py.File('path/to/file.ext') >>> test = fileobj['SomeKey'] >>> test.dtype dtype('float64') >>> test

我想知道通过h5py访问数据是否有任何特殊限制?我期望从相关数据集中得到一个包含内部数组的数组

我可以将对象加载到内存中,访问数据文件中的大部分键

>>> import h5py

>>> fileobj = h5py.File('path/to/file.ext')
>>> test = fileobj['SomeKey']
>>> test.dtype
dtype('float64')
>>> test[:]
array([  3.50000460e+02,   1.23662217e-03,   1.23662872e-03, ...,
     9.94521356e-03,   9.94531916e-03,   9.94542476e-03])
>>> test.shape
(49682960,)
>>> # this loads fine
... problem = fileobj['SomeOtherKey']
>>> problem.shape
(13570,)
>>> # accessing specific keys works fine too
... sub_dset = problem['subkey1']
>>> sub_dset.dtype
dtype('O')
# checking compression, nothing out of the ordinary...
>>> problem._filters
{'gzip': 1, 'shuffle': (144,)}
>>> problem.dtype['subkey2']
dtype('O')
>>> problem['subkey2']
Segmentation fault
当我尝试切片、复制数据集等时也会发生这种情况

>>> problem['subkey2'][:]
Segmentation fault

>>> problem['subkey2']
>>> import numpy as np
>>> arr = np.zeros(problem.shape)
>>> # this works fine
... ds = fileobj.create_dataset('ds', data=problem['subkey1'])
>>> # this also works fine
... ds1 = f.create_dataset('ds1', problem.shape, problem.dtype, data=problem['subkey1'])
>>> # however.....
... ds2 = f.create_dataset('ds2', problem.shape, problem.dtype, data=problem)
Segmentation Fault
>>> ds = f.create_dataset('ds2', data=problem['subkey2'])
Segmentation Fault
起初我认为这可能是内存问题。但是,我使用一个用作测试库的标准文件(我相信现在已弃用)对其进行了测试:

在这种情况下,问题将以以下示例再现:

>>> fileobj = h5py.File('test.mz5')
>>> problem = fileobj['SpectrumMetaData']
>>> problem.shape
(26,)
>>> problem['precursors']
Segmentation Fault
我已经检查过了,SpectrumMetaData数据集的“id”(以及其他键)很好,并且这个示例没有压缩过滤器,这表明分段错误是由数据本身造成的

为了以防万一,这是Python版本或特定于h5py的版本,我已经在带有Python 2.7.9的h5py版本2.5.0上运行了所有以前的测试

当我在h5py版本2.2.1(Ubuntu、Python 3.4.3)上试用时,我得到:

我知道可变长度数据类型的支持在h5py之后得到了改进,所以我在Python3上升级到了h5py 2.5.0,并得到了与以前相同的问题


使用h5py和更高级别的API访问此数据有何方法?如果可能的话,我不想在Cython中构建自定义数据类型。

我很确定这是一个bug,可能是一个可能的解决方法,可能是使用低级API获取部件的数据类型(使用
prob\u type=problem.id.get\u type()
prob\u type.get\u member\u type()
),并构建一个新的数据类型,用固定尺寸的等效件更换vlen零件。
TypeError: No NumPy equivalent for TypeVlenID exists