Unpickling Python2 Datetime Under Python3
I chose to use pickle (+base64+TCP sockets) to communicate data between my python3 code and legacy python2 code, but I am having trouble with datetime objects: The PY3 object unpic
Solution 1:
The workaround is to use the encoding="bytes"
like this:
pickled_bytes = bytes(pickled_str, encoding='latin1') # If your input is a string(not my case)data = pickle.loads(pickled_bytes, encoding='bytes')
(Thanks to Tim Peters for the suggestion)
Issue still opened at http://bugs.python.org/issue22005 as to why this is required.
Post a Comment for "Unpickling Python2 Datetime Under Python3"