gpt4 book ai didi

Python: h5py 给出 OSError: Can't read data (inflate() failed) 即使它之前打开过

转载 作者:太空宇宙 更新时间:2023-11-03 10:52:46 28 4
gpt4 key购买 nike

python 3.5。我在一个目录中有几百个 .mat mat 文件(7.3 版)。我正在遍历所有这些以提取数据的两个不同部分。我遍历并获得并获得第一批完全没有问题但是当我再次做完全相同的事情时我只提取了数据的不同部分我得到以下错误:

Traceback (most recent call last):
File "v73_test.py", line 43, in <module>
mrfs_data = extract.convert1simProteinComCountsIntoDataFrame(path2mats)
File "/home/oli/Downloads/PhD/wc/mg/version_73_stuff/functions_for_joshuas_matFiles/extract_matFile_data_v73.py", line 586, in convert1simProteinComCountsIntoDataFrame
raw_data = getMatureProteinComplexs(path2mats, state_no)
File "/home/oli/Downloads/PhD/wc/mg/version_73_stuff/functions_for_joshuas_matFiles/extract_matFile_data_v73.py", line 53, in getMatureProteinComplexs
if len(np.array(state_file['ProteinComplex']['counts']).shape) == 3:
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "/home/oli/virtualenvs/standard_python3.5/lib/python3.5/site-packages/h5py/_hl/dataset.py", line 696, in __array__
self.read_direct(arr)
File "/home/oli/virtualenvs/standard_python3.5/lib/python3.5/site-packages/h5py/_hl/dataset.py", line 657, in read_direct
self.id.read(mspace, fspace, dest, dxpl=self._dxpl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5d.pyx", line 181, in h5py.h5d.DatasetID.read
File "h5py/_proxy.pyx", line 130, in h5py._proxy.dset_rw
File "h5py/_proxy.pyx", line 84, in h5py._proxy.H5PY_H5Dread
OSError: Can't read data (inflate() failed)

所以文件确实存在并且可以访问,所以我唯一能想到的就是数据已损坏,但如果是这样的话,我肯定无法从中提取任何数据吗?

最佳答案

我在这里回答了我自己的问题,因为网上没有太多关于这个错误的信息,我学到了一些东西,所以也许它会对其他人有所帮助。

所以我意识到数据实际上已损坏。我认为如果文件已损坏,那么您将无法从中提取任何内容,但事实证明,在这种情况下这不是真的,您无法访问的唯一位是已损坏的特定位。根据过去对其他版本的 .mat 文件的经验,这不是我所期望的,但现在我想这个版本实际上是什么,它似乎很明显。

关于Python: h5py 给出 OSError: Can't read data (inflate() failed) 即使它之前打开过,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47110235/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com