Reputation: 58893
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.
Upvotes: 0
Views: 1414
Reputation: 1139
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))
Upvotes: 8