'error: Error -3 while decompressing data: invalid distance too far back

While I am trying to load the .mat file in Python, I am facing the following error:

    error                                     Traceback (most recent call last)
<ipython-input-4-c3171c29e3cc> in <module>()
      1 if __name__ == '__main__':
      2     print('Inside Main')
----> 3     mat = loadmat("/content/01_01_c0001_info.mat")
      4     print("File Read........")

2 frames
/usr/local/lib/python3.7/dist-packages/scipy/io/matlab/mio5.py in read_var_header(self)
    224             self._matrix_reader.set_stream(stream)
    225             check_stream_limit = self.verify_compressed_data_integrity
--> 226             mdtype, byte_count = self._matrix_reader.read_full_tag()
    227         else:
    228             check_stream_limit = False

mio5_utils.pyx in scipy.io.matlab.mio5_utils.VarReader5.read_full_tag()

mio5_utils.pyx in scipy.io.matlab.mio5_utils.VarReader5.cread_full_tag()

streams.pyx in scipy.io.matlab.streams.ZlibInputStream.read_into()

streams.pyx in scipy.io.matlab.streams.ZlibInputStream._fill_buffer()

error: Error -3 while decompressing data: invalid distance too far back

As we can see the error is occurring in the loadmat function.

The code example is given below:

import numpy as np
from scipy.io import loadmat

if __name__ == '__main__':
    print('Inside Main')
    mat = loadmat("/content/01_01_c0001_info.mat")
    print("File Read........")


Solution 1:[1]

File was corrupted. Downloaded it again. It is fixed now. Thank you

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anas Zafar