Is there a way to load Python 3.6 pickle in Python 3.8?

Viewed 337

I have a pickle file created in Python 3.6 with protocol=pickle.HIGHEST_PROTOCOL, which is 4.

with open(file_path, 'wb') as ff: 
    pickle.dump(data, ff, protocol=pickle.HIGHEST_PROTOCOL)

I am trying load the file in Python 3.8, where pickle.DEFAULT_PROTOCOL = 4.

with open(file_path, 'rb') as ff: 
        data = pickle.load(ff)

I am getting TypeError: an integer is required (got type bytes). I tried adding different encodings to the pickle.load call (pickle.load(ff, encodings=...)) but I have no idea what is the problem with the file. Is this some backward-incompatibility with Python 3.8?

0 Answers
Related