I\'m trying to storage 5000 data elements on an array. This 5000 elements are storage on an existent file (therefore it\'s not empty).
But I\'m getting an error an
This may not be relevant to your specific issue, but I had a similar problem when the pickle archive had been created using gzip
.
For example if a compressed pickle archive is made like this,
import gzip, pickle
with gzip.open('test.pklz', 'wb') as ofp:
pickle.dump([1,2,3], ofp)
Trying to open it throws the errors
with open('test.pklz', 'rb') as ifp:
print(pickle.load(ifp))
Traceback (most recent call last):
File "", line 2, in
_pickle.UnpicklingError: invalid load key, ''.
But, if the pickle file is opened using gzip
all is harmonious
with gzip.open('test.pklz', 'rb') as ifp:
print(pickle.load(ifp))
[1, 2, 3]