tags:

views:

38

answers:

1

Hi, i have a large dictionary I'd like to save. I have pickled it using cPickle.dumps and saved the result into a TextField. When trying to retrieve it (cPicle.loads) i get the following error:

loads() argument 1 must be string, not unicode

Does anybody have any experience in serializing python objects and storing them in a DB using Django? Thanks in advance.

+7  A: 

The best advice you're probably going to get is to use json rather than pickle not only for security reasons, but also because it's simply a string which can easily be read and modified if necessary.

edit: in response to the actual problem you're having -

pickle.loads(str(textfield))
dagoof
+1: Use JSON instead of pickle for this.
S.Lott