I'm trying to loads a pickle string in python3.8,but pickle.loads
get error _pickle.UnpicklingError: slot state is not a dictionary
,this string is read from postgresql,In python2 it is working, I found python3's version pickle only support loads bytes type data,but python2 support str
type.
I used six
library to loads string, but get a another error UnpicklingError: slot state is not a dictionary
,I tried to print slot, it is a list type object,thats a confused problem.
my python2 code:
a = "" # the dumps string
result = pickle.loads(a) # its working
print "result type", type(result) # <type 'dict'>
python3 code:
a = ""
result = pickle.loads(a.encode('utf-8'), fix_imports=True, encoding='utf-8')
# error: _pickle.UnpicklingError: slot state is not a dictionary