I am trying to read a gzipped file in my python code using the following code:
with open(metavisits_cov_file, 'r') as fin:
for line in fin:
lcount+=1
vals = line.decode('utf8').strip().split(',') #for zipped file
print (vals)
But the code is giving the following error:
Traceback (most recent call last):
File "test.py", line 11, in <module>
for line in fin:
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte