I am trying to convert an Audio file to text . Audio is saved as Wel.wav in my desktop.
Below is the code:
import speech_recognition as sr
r = sr.Recognizer()
audio = 'Wel.wav'
with sr.AudioFile(audio) as source:
audio = r.record(source)
print ('Done!')
try:
text = r.recognize_google(audio)
print (text)
except Exception as e:
print (e)
I am getting the below error:
FileNotFoundError Traceback (most recent call last)
<ipython-input-27-432c6c552a8c> in <module>()
5 audio = 'Wel.wav'
6
----> 7 with sr.AudioFile(audio) as source:
8 audio = r.record(source)
9 print ('Done!')
C:\Users\user\Anaconda3\lib\site-packages\speech_recognition\__init__.py in
__enter__(self)
201 try:
202 # attempt to read the file as WAV
--> 203 self.audio_reader =
wave.open(self.filename_or_fileobject, "rb")
204 self.little_endian = True # RIFF WAV is a little-endian
format (most ``audioop`` operations assume that the frames are stored in
little-endian form)
205 except (wave.Error, EOFError):
C:\Users\user\Anaconda3\lib\wave.py in open(f, mode)
497 mode = 'rb'
498 if mode in ('r', 'rb'):
--> 499 return Wave_read(f)
500 elif mode in ('w', 'wb'):
501 return Wave_write(f)
C:\Users\user\Anaconda3\lib\wave.py in __init__(self, f)
157 self._i_opened_the_file = None
158 if isinstance(f, str):
--> 159 f = builtins.open(f, 'rb')
160 self._i_opened_the_file = f
161 # else, assume it is an open file object already
FileNotFoundError: [Errno 2] No such file or directory: 'Wel.wav'
Now when i try to give it with directory location,
i have changed the audio command as
audio = 'C:\\Users\\user\\Desktop\\Wel.wav'
It is throwing the below error :
Error Traceback (most recent call last)
C:\Users\user\Anaconda3\lib\site-packages\speech_recognition\__init__.py in
__enter__(self)
202 # attempt to read the file as WAV
--> 203 self.audio_reader =
wave.open(self.filename_or_fileobject, "rb")
204 self.little_endian = True # RIFF WAV is a little-endian
format (most ``audioop`` operations assume that the frames are stored in
little-endian form)
C:\Users\user\Anaconda3\lib\wave.py in open(f, mode)
498 if mode in ('r', 'rb'):
--> 499 return Wave_read(f)
500 elif mode in ('w', 'wb'):
C:\Users\user\Anaconda3\lib\wave.py in __init__(self, f)
162 try:
--> 163 self.initfp(f)
164 except:
C:\Users\user\Anaconda3\lib\wave.py in initfp(self, file)
129 if self._file.getname() != b'RIFF':
--> 130 raise Error('file does not start with RIFF id')
131 if self._file.read(4) != b'WAVE':
Error: file does not start with RIFF id
During handling of the above exception, another exception occurred:
Error Traceback (most recent call last)
C:\Users\user\Anaconda3\lib\site-packages\speech_recognition\__init__.py in
__enter__(self)
207 # attempt to read the file as AIFF
--> 208 self.audio_reader =
aifc.open(self.filename_or_fileobject, "rb")
209 self.little_endian = False # AIFF is a big-endian
format
C:\Users\user\Anaconda3\lib\aifc.py in open(f, mode)
889 if mode in ('r', 'rb'):
--> 890 return Aifc_read(f)
891 elif mode in ('w', 'wb'):
C:\Users\user\Anaconda3\lib\aifc.py in __init__(self, f)
339 # else, assume it is an open file object already
--> 340 self.initfp(f)
341
C:\Users\user\Anaconda3\lib\aifc.py in initfp(self, file)
304 if chunk.getname() != b'FORM':
--> 305 raise Error('file does not start with FORM id')
306 formdata = chunk.read(4)
Error: file does not start with FORM id
During handling of the above exception, another exception occurred:
EOFError Traceback (most recent call last)
C:\Users\user\Anaconda3\lib\site-packages\speech_recognition\__init__.py in
__enter__(self)
233 try:
--> 234 self.audio_reader = aifc.open(aiff_file, "rb")
235 except (aifc.Error, EOFError):
C:\Users\user\Anaconda3\lib\aifc.py in open(f, mode)
889 if mode in ('r', 'rb'):
--> 890 return Aifc_read(f)
891 elif mode in ('w', 'wb'):
C:\Users\user\Anaconda3\lib\aifc.py in __init__(self, f)
339 # else, assume it is an open file object already
--> 340 self.initfp(f)
341
C:\Users\user\Anaconda3\lib\aifc.py in initfp(self, file)
302 self._file = file
--> 303 chunk = Chunk(file)
304 if chunk.getname() != b'FORM':
C:\Users\user\Anaconda3\lib\chunk.py in __init__(self, file, align,
bigendian, inclheader)
62 if len(self.chunkname) < 4:
---> 63 raise EOFError
64 try:
EOFError:
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-29-5bee547ee15e> in <module>()
5 audio = 'C:\\Users\\user\\Desktop\\Wel.wav'
6
----> 7 with sr.AudioFile(audio) as source:
8 audio = r.record(source)
9 print ('Done!')
C:\Users\user\Anaconda3\lib\site-packages\speech_recognition\__init__.py
in __enter__(self)
234 self.audio_reader = aifc.open(aiff_file, "rb")
235 except (aifc.Error, EOFError):
--> 236 raise ValueError("Audio file could not be read
as PCM WAV, AIFF/AIFF-C, or Native FLAC; check if file is corrupted or in
another format")
237 self.little_endian = False # AIFF is a big-endian
format
238 assert 1 <= self.audio_reader.getnchannels() <= 2, "Audio must
be mono or stereo"
ValueError: Audio file could not be read as PCM WAV, AIFF/AIFF-C, or Native
FLAC; check if file is corrupted or in another format
Could anyone please help me regarding this .
Related
Im using jupyter notebook for executing this. The Whole program is available in this link https://github.com/MiteshPuthran/Speech-Emotion-Analyzer/blob/master/final_results_gender_test.ipynb
I tried using ffmpeg, tried using another .wav file, nothing seems to be working. please help.
This is the code :
df = pd.DataFrame(columns=['feature'])
bookmark=0
for index,y in enumerate(mylist):
if mylist[index][6:-16]!='01' and mylist[index][6:-16]!='07' and mylist[index][6:-16]!='08' and mylist[index][:2]!='su' and mylist[index][:1]!='n' and mylist[index][:1]!='d':
X, sample_rate = librosa.load('C:/Users/Admin/Desktop/pw-4/Speech-Emotion-Analyzer-master/Speech-Emotion-Analyzer-master/'+y, res_type='kaiser_fast',duration=2.5,sr=22050*2,offset=0.5)
sample_rate = np.array(sample_rate)
mfccs = np.mean(librosa.feature.mfcc(y=X,
sr=sample_rate,
n_mfcc=13),
axis=0)
feature = mfccs
#[float(i) for i in feature]
#feature1=feature[:135]
df.loc[bookmark] = [feature]
bookmark=bookmark+1
and this is the error im getting:
RuntimeError Traceback (most recent call last)
File ~\AppData\Roaming\Python\Python39\site-packages\librosa\core\audio.py:155, in load(path, sr, mono, offset, duration, dtype, res_type)
153 else:
154 # Otherwise, create the soundfile object
--> 155 context = sf.SoundFile(path)
157 with context as sf_desc:
File ~\AppData\Roaming\Python\Python39\site-packages\soundfile.py:629, in SoundFile.__init__(self, file, mode, samplerate, channels, subtype, endian, format, closefd)
627 self._info = _create_info_struct(file, mode, samplerate, channels,
628 format, subtype, endian)
--> 629 self._file = self._open(file, mode_int, closefd)
630 if set(mode).issuperset('r+') and self.seekable():
631 # Move write position to 0 (like in Python file objects)
File ~\AppData\Roaming\Python\Python39\site-packages\soundfile.py:1183, in SoundFile._open(self, file, mode_int, closefd)
1182 raise TypeError("Invalid file: {0!r}".format(self.name))
-> 1183 _error_check(_snd.sf_error(file_ptr),
1184 "Error opening {0!r}: ".format(self.name))
1185 if mode_int == _snd.SFM_WRITE:
1186 # Due to a bug in libsndfile version <= 1.0.25, frames != 0
1187 # when opening a named pipe in SFM_WRITE mode.
1188 # See http://github.com/erikd/libsndfile/issues/77.
File ~\AppData\Roaming\Python\Python39\site-packages\soundfile.py:1357, in _error_check(err, prefix)
1356 err_str = _snd.sf_error_number(err)
-> 1357 raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening 'C:/Users/Admin/Desktop/pw-4/Speech-Emotion-Analyzer-master/Speech-Emotion-Analyzer-master/AudioRecorder.ipynb': File contains data in an unknown format.
During handling of the above exception, another exception occurred:
NoBackendError Traceback (most recent call last)
Input In [46], in <cell line: 3>()
3 for index,y in enumerate(mylist):
4 if mylist[index][6:-16]!='01' and mylist[index][6:-16]!='07' and mylist[index][6:-16]!='08' and mylist[index][:2]!='su' and mylist[index][:1]!='n' and mylist[index][:1]!='d':
----> 5 X, sample_rate = librosa.load('C:/Users/Admin/Desktop/pw-4/Speech-Emotion-Analyzer-master/Speech-Emotion-Analyzer-master/'+y, res_type='kaiser_fast',duration=2.5,sr=22050*2,offset=0.5)
6 sample_rate = np.array(sample_rate)
7 mfccs = np.mean(librosa.feature.mfcc(y=X,
8 sr=sample_rate,
9 n_mfcc=13),
10 axis=0)
File ~\AppData\Roaming\Python\Python39\site-packages\librosa\util\decorators.py:88, in deprecate_positional_args.<locals>._inner_deprecate_positional_args.<locals>.inner_f(*args, **kwargs)
86 extra_args = len(args) - len(all_args)
87 if extra_args <= 0:
---> 88 return f(*args, **kwargs)
90 # extra_args > 0
91 args_msg = [
92 "{}={}".format(name, arg)
93 for name, arg in zip(kwonly_args[:extra_args], args[-extra_args:])
94 ]
File ~\AppData\Roaming\Python\Python39\site-packages\librosa\core\audio.py:174, in load(path, sr, mono, offset, duration, dtype, res_type)
172 if isinstance(path, (str, pathlib.PurePath)):
173 warnings.warn("PySoundFile failed. Trying audioread instead.", stacklevel=2)
--> 174 y, sr_native = __audioread_load(path, offset, duration, dtype)
175 else:
176 raise (exc)
File ~\AppData\Roaming\Python\Python39\site-packages\librosa\core\audio.py:198, in __audioread_load(path, offset, duration, dtype)
192 """Load an audio buffer using audioread.
193
194 This loads one block at a time, and then concatenates the results.
195 """
197 y = []
--> 198 with audioread.audio_open(path) as input_file:
199 sr_native = input_file.samplerate
200 n_channels = input_file.channels
File ~\AppData\Roaming\Python\Python39\site-packages\audioread\__init__.py:116, in audio_open(path, backends)
113 pass
115 # All backends failed!
--> 116 raise NoBackendError()
NoBackendError:
I read some Audio file, labeled them, and together with their path, save the path and emotion of each Audioo file in a csv file. Now I want to read their path from the file and open them but I get this Error:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
File ~\.conda\envs\nhashemi\lib\site-packages\librosa\core\audio.py:155, in load(path, sr, mono, offset, duration, dtype, res_type)
153 else:
154 # Otherwise, create the soundfile object
--> 155 context = sf.SoundFile(path)
157 with context as sf_desc:
File ~\.conda\envs\nhashemi\lib\site-packages\soundfile.py:629, in SoundFile.__init__(self, file, mode, samplerate, channels, subtype, endian, format, closefd)
627 self._info = _create_info_struct(file, mode, samplerate, channels,
628 format, subtype, endian)
--> 629 self._file = self._open(file, mode_int, closefd)
630 if set(mode).issuperset('r+') and self.seekable():
631 # Move write position to 0 (like in Python file objects)
File ~\.conda\envs\nhashemi\lib\site-packages\soundfile.py:1183, in SoundFile._open(self, file, mode_int, closefd)
1182 raise TypeError("Invalid file: {0!r}".format(self.name))
-> 1183 _error_check(_snd.sf_error(file_ptr),
1184 "Error opening {0!r}: ".format(self.name))
1185 if mode_int == _snd.SFM_WRITE:
1186 # Due to a bug in libsndfile version <= 1.0.25, frames != 0
1187 # when opening a named pipe in SFM_WRITE mode.
1188 # See http://github.com/erikd/libsndfile/issues/77.
File ~\.conda\envs\nhashemi\lib\site-packages\soundfile.py:1357, in _error_check(err, prefix)
1356 err_str = _snd.sf_error_number(err)
-> 1357 raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening 'C:/Users/external_dipf/Documents/Dataset/CREMA/AudioWAV/1001_IEO_FEA_HI.wav': File contains data in an unknown format.
During handling of the above exception, another exception occurred:
NoBackendError Traceback (most recent call last)
Input In [553], in <cell line: 3>()
1 emotion='fear'
2 path = np.array(data_path.Path[data_path.Emotions==emotion])[1]
----> 3 data, sampling_rate = librosa.load(path)
4 create_waveplot(data, sampling_rate, emotion)
5 create_spectrogram(data, sampling_rate, emotion)
File ~\.conda\envs\nhashemi\lib\site-packages\librosa\util\decorators.py:88, in deprecate_positional_args.<locals>._inner_deprecate_positional_args.<locals>.inner_f(*args, **kwargs)
86 extra_args = len(args) - len(all_args)
87 if extra_args <= 0:
---> 88 return f(*args, **kwargs)
90 # extra_args > 0
91 args_msg = [
92 "{}={}".format(name, arg)
93 for name, arg in zip(kwonly_args[:extra_args], args[-extra_args:])
94 ]
File ~\.conda\envs\nhashemi\lib\site-packages\librosa\core\audio.py:174, in load(path, sr, mono, offset, duration, dtype, res_type)
172 if isinstance(path, (str, pathlib.PurePath)):
173 warnings.warn("PySoundFile failed. Trying audioread instead.", stacklevel=2)
--> 174 y, sr_native = __audioread_load(path, offset, duration, dtype)
175 else:
176 raise (exc)
File ~\.conda\envs\nhashemi\lib\site-packages\librosa\core\audio.py:198, in __audioread_load(path, offset, duration, dtype)
192 """Load an audio buffer using audioread.
193
194 This loads one block at a time, and then concatenates the results.
195 """
197 y = []
--> 198 with audioread.audio_open(path) as input_file:
199 sr_native = input_file.samplerate
200 n_channels = input_file.channels
File ~\.conda\envs\nhashemi\lib\site-packages\audioread\__init__.py:116, in audio_open(path, backends)
113 pass
115 # All backends failed!
--> 116 raise NoBackendError()
NoBackendError:
Here is my code to label and specify the label (emotion) of each file
CREMA ="C:/Users/external_dipf/Documents/Dataset/CREMA/AudioWAV/"
crema_directory_list = os.listdir(CREMA)
file_emotion = []
file_path = []
for file in crema_directory_list:
# storing file paths
file_path.append(CREMA + file)
# storing file emotions
part=file.split('_')
if part[2] == 'SAD':
file_emotion.append('sad')
elif part[2] == 'ANG':
file_emotion.append('angry')
elif part[2] == 'DIS':
file_emotion.append('disgust')
elif part[2] == 'FEA':
file_emotion.append('fear')
elif part[2] == 'HAP':
file_emotion.append('happy')
elif part[2] == 'NEU':
file_emotion.append('neutral')
else:
file_emotion.append('Unknown')
# dataframe for emotion of files
emotion_df = pd.DataFrame(file_emotion, columns=['Emotions'])
# dataframe for path of files.
path_df = pd.DataFrame(file_path, columns=['Path'])
CREMA_df = pd.concat([emotion_df, path_df], axis=1)
CREMA_df.head()
Here is were I save them in a CSV file
data_path = pd.concat([CREMA_df, RAVDESS_df, TESS_df, SAVEE_df], axis = 0)
data_path.to_csv("data_path.csv",index=False)
data_path.head()
and here I am trying to read the file. The error is related to the CREMA dataset.
emotion='fear'
path = np.array(data_path.Path[data_path.Emotions==emotion])[1]
data, sampling_rate = librosa.load(path)
create_waveplot(data, sampling_rate, emotion)
create_spectrogram(data, sampling_rate, emotion)
Audio(path)
I checked the path file, everything was correct. I can open other wav files. My librosa version is 0.9.1
Hi i am having issues with loading the .s2p file
when i ran the following code
import skrf as rf
from skrf import Network, Frequency
data1 = rf.Network('/Users/pradeeps/Desktop/Project/meas2018_07_06/300MHzNLOSX1DPS.s2p')
It showed the following error as shown below
---------------------------------------------------------------------------
UnpicklingError Traceback (most recent call last)
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/network.py:450, in Network.__init__(self, file, name, params, comments, f_unit, s_def, **kwargs)
449 try:
--> 450 self.read(fid)
451 except UnicodeDecodeError: # Support for pickles created in Python2 and loaded in Python3
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/network.py:2357, in Network.read(self, *args, **kwargs)
2356 from .io.general import read
-> 2357 self.copy_from(read(*args, **kwargs))
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/io/general.py:140, in read(file, *args, **kwargs)
139 try:
--> 140 obj = pickle.load(fid, *args, **kwargs)
141 except (UnpicklingError, UnicodeDecodeError) as e:
142 # if fid is seekable then reset to beginning of file
UnpicklingError: invalid load key, '3'.
During handling of the above exception, another exception occurred:
NotImplementedError Traceback (most recent call last)
Untitled-1.ipynb Cell 2' in <cell line: 1>()
----> 1 data1 = rf.Network('/Users/pradeeps/Desktop/Project/meas2018_07_06/300MHzNLOSX1DPS.s2p')
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/network.py:458, in Network.__init__(self, file, name, params, comments, f_unit, s_def, **kwargs)
456 filename = fid.name
457 fid.close()
--> 458 self.read_touchstone(filename, self.encoding)
460 if name is None and isinstance(file, str):
461 name = os.path.splitext(os.path.basename(file))[0]
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/network.py:1956, in Network.read_touchstone(self, filename, encoding)
1953 touchstoneFile = touchstone.Touchstone(filename, encoding=encoding)
1955 if touchstoneFile.get_format().split()[1] != 's':
-> 1956 raise NotImplementedError('only s-parameters supported for now.')
1958 self.comments = touchstoneFile.get_comments()
1960 try:
NotImplementedError: only s-parameters supported for now.
As shown in this particular code i used scikit-rf is there any other package that i should use in this particular instance or am i doing anything wrong.
Thank you
I am trying to generate spectrograms by using Librosa. When I was working with the .wav format file it was working fine. But I changed the format to OPUS audio codec and tried to run the same file, it give me below error.
X, sample_rate = librosa.load('TESS emotion datasets opus/OAF_Fear/OAF_beg_fear.opus', res_type='kaiser_fast', duration = 2.5, sr = 22050*2, offset = 0.5)
Error generated:
RuntimeError Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/librosa/core/audio.py in load(path, sr, mono, offset, duration, dtype, res_type)
145 try:
--> 146 with sf.SoundFile(path) as sf_desc:
147 sr_native = sf_desc.samplerate
~/anaconda3/lib/python3.6/site-packages/soundfile.py in __init__(self, file, mode, samplerate, channels, subtype, endian, format, closefd)
628 format, subtype, endian)
--> 629 self._file = self._open(file, mode_int, closefd)
630 if set(mode).issuperset('r+') and self.seekable():
~/anaconda3/lib/python3.6/site-packages/soundfile.py in _open(self, file, mode_int, closefd)
1183 _error_check(_snd.sf_error(file_ptr),
-> 1184 "Error opening {0!r}: ".format(self.name))
1185 if mode_int == _snd.SFM_WRITE:
~/anaconda3/lib/python3.6/site-packages/soundfile.py in _error_check(err, prefix)
1356 err_str = _snd.sf_error_number(err)
-> 1357 raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
1358
RuntimeError: Error opening 'TESS emotion datasets opus/OAF_Fear/OAF_beg_fear.opus': File contains data in an unimplemented format.
During handling of the above exception, another exception occurred:
NoBackendError Traceback (most recent call last)
<ipython-input-39-1372f02f676e> in <module>()
----> 1 X, sample_rate = librosa.load('TESS emotion datasets opus/OAF_Fear/OAF_beg_fear.opus', res_type='kaiser_fast', duration = 2.5, sr = 22050*2, offset = 0.5)
~/anaconda3/lib/python3.6/site-packages/librosa/core/audio.py in load(path, sr, mono, offset, duration, dtype, res_type)
161 if isinstance(path, (str, pathlib.PurePath)):
162 warnings.warn("PySoundFile failed. Trying audioread instead.")
--> 163 y, sr_native = __audioread_load(path, offset, duration, dtype)
164 else:
165 raise (exc)
~/anaconda3/lib/python3.6/site-packages/librosa/core/audio.py in __audioread_load(path, offset, duration, dtype)
185
186 y = []
--> 187 with audioread.audio_open(path) as input_file:
188 sr_native = input_file.samplerate
189 n_channels = input_file.channels
~/anaconda3/lib/python3.6/site-packages/audioread/__init__.py in audio_open(path, backends)
114
115 # All backends failed!
--> 116 raise NoBackendError()
NoBackendError:
I tried to install ffmpeg and gstreamer as suggested by some previous answers and github page of Librosa. But it didn't solve the problem.
On the contrary, this audio format works well when I run the same code in Google Colab.
What can be the reason of this error? How to solve it?
I am following a tutorial here: https://towardsdatascience.com/multi-class-text-classification-model-comparison-and-selection-5eb066197568
I am at the part "Word2vec and Logistic Regression". I have downloaded the "GoogleNews-vectors-negative300.bin.gz" file and I am tyring to apply it to my own text data. However when I get to the following code:
%%time
from gensim.models import Word2Vec
wv = gensim.models.KeyedVectors.load_word2vec_format("/data/users/USERS/File_path/classifier/GoogleNews_Embedding/GoogleNews-vectors-negative300.bin.gz", binary=True)
wv.init_sims(replace=True)
I run into the following error:
/data/users/msmith/env/lib64/python3.6/site-packages/smart_open/smart_open_lib.py:398: UserWarning: This function is deprecated, use smart_open.open instead. See the migration notes for details: https://github.com/RaRe-Technologies/smart_open/blob/master/README.rst#migrating-to-the-new-open-function
'See the migration notes for details: %s' % _MIGRATION_NOTES_URL
---------------------------------------------------------------------------
EOFError Traceback (most recent call last)
<timed exec> in <module>
~/env/lib64/python3.6/site-packages/gensim/models/keyedvectors.py in load_word2vec_format(cls, fname, fvocab, binary, encoding, unicode_errors, limit, datatype)
1492 return _load_word2vec_format(
1493 cls, fname, fvocab=fvocab, binary=binary, encoding=encoding, unicode_errors=unicode_errors,
-> 1494 limit=limit, datatype=datatype)
1495
1496 def get_keras_embedding(self, train_embeddings=False):
~/env/lib64/python3.6/site-packages/gensim/models/utils_any2vec.py in _load_word2vec_format(cls, fname, fvocab, binary, encoding, unicode_errors, limit, datatype)
383 with utils.ignore_deprecation_warning():
384 # TODO use frombuffer or something similar
--> 385 weights = fromstring(fin.read(binary_len), dtype=REAL).astype(datatype)
386 add_word(word, weights)
387 else:
/usr/lib64/python3.6/gzip.py in read(self, size)
274 import errno
275 raise OSError(errno.EBADF, "read() on write-only GzipFile object")
--> 276 return self._buffer.read(size)
277
278 def read1(self, size=-1):
/usr/lib64/python3.6/_compression.py in readinto(self, b)
66 def readinto(self, b):
67 with memoryview(b) as view, view.cast("B") as byte_view:
---> 68 data = self.read(len(byte_view))
69 byte_view[:len(data)] = data
70 return len(data)
/usr/lib64/python3.6/gzip.py in read(self, size)
480 break
481 if buf == b"":
--> 482 raise EOFError("Compressed file ended before the "
483 "end-of-stream marker was reached")
484
EOFError: Compressed file ended before the end-of-stream marker was reached
Any idea whats gone wrong/ how to overcome this issue?
Thanks in advance!