ids = cPickle.loads(gem.value)
loads() argument 1 must be string, not unicode
cPickle.loads
wants a byte string (which is exactly what cPickle.dumps
outputs) and you're feeding it a unicode string instead. You'll need to "encode" that Unicode string to get back the byte string that dumps
had originally given you, but it's hard to guess what encoding you accidentally imposed on it -- maybe latin-1
or utf-8
(if ascii
don't worry, either of those two will decode it just great), maybe utf-16
...? It's hard to guess without knowing what gem
is and how you originally set its value
from the output of a cPickle.dumps
...!