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 "<stdin>", line 2, in <module>
_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]