2

I have a huge set of python 2 pickled data files that contain numpy arrays and images. I want to transfer them to python 3 but run into several problems. When I try to unpickle the data in python 3, it throws me several errors similar to the ones seen in:

Unpickling a python 2 object with python 3

TypeError: a bytes-like object is required, not 'str' when opening Python 2 Pickle file in Python 3

and none of the answers work. I tried decoding as suggested in the second link setting encode parameter to "utf-8", "latin1" as well as "bytes". The accepted answer was a corruption in pickled data, so I repickled in python 2 as well but this did not solve the issue.

Lastly, I decided to unpickle it in python 2 and use a json file to transfer the data. The files unpickle successfully but json file does not accept images as is. What are my options for transferring this data to python 3, without any external libraries if possible?

Ai coding ai
  • 53
  • 1
  • 7

0 Answers0