Pickle in a POST/GET request give EOFError

Adam Tauno Williams awilliam at whitemice.org
Thu Nov 18 14:24:37 CET 2010


On Thu, 2010-11-18 at 11:22 +0100, Romaric DEFAUX wrote: 
> Hi again,
> I try simplejson, but I have a problem. (I just replace pickle 
> everywhere by simplejson)
> Explanation :
> I "dumps" with json a list of dictionnaries into disk_list_json.
> When I "loads" it, I don't get my list of dictionnaries like before (see 
> disk_list2). It adds "u" letter everywhere.

Correct; I strongly disagree with the assertion to use JSON over Pickle.
Pickle is superior for serialization - JSON does not preserve type.  Use
Pickle when possible.  JSON is best for communicating simple data to
stupid clients [web browsers].  JSON doesn't know about dates, it
doesn't know about string vs. unicode, etc...

-- 
Adam Tauno Williams <awilliam at whitemice.org>




More information about the Python-list mailing list