_pickle.UnpicklingError: invalid upload key, 'x'

I have this pickle file which I am trying to expand with the following Python script:

import _pickle as pickle

pickle_file = open('bof.pkl', 'rb')
data = pickle.load(pickle_file)

      

When I run the program, I get the following error:

Traceback (most recent call last):
  File "unpickle.py", line 4, in <module>
    data = pickle.load(pickle_file)
_pickle.UnpicklingError: invalid load key, 'x'.

      

How can I solve this problem as I couldn't find a way to do it.

+3


source to share


1 answer


I found that the program was using from sklearn.externals import joblib

and thus saved the pickle file like this:

joblib.dump(....)

      



This way I was able to download the contents of the pickle like this:

clf = joblib.load('pickle_file.pkl')

      

0


source







All Articles