title: Python: h5py gives OSError: Can't read data (inflate() failed) even though it's opened it before
body: <p>Python 3.5. I have a few hundred .mat mat files (version 7.3) in a directory. I am looping through all of them to extract two different parts of data. I loop through and get and get the first lot with no problems at all but when I do the exact same thing again only I extract a different part of the data I get the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "v73_test.py", line 43, in &lt;module&gt;
      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)
  </code></pre>
  
  <p>So the file is definitely there and accessible so the only thing I can think of is the data is corrupted but if that is the case surely I wouldn't have been able to extract any data from it all?</p>