0

One of the tables of my database in Django contains the dictionary below. When dumping the table as .csv and looking at the column where the dict is stored, I get some awkward results.

{""my_key"": 
{""__pickled__"":""gANjbnVtcHkuY29yZS5tdWx0aWFycmF5CnNjYWxhcgpxAGNudW1weQpkdHlwZQpxAVgCAAAAaThxAksASwGHcQNScQQoSwNYAQAAADxxBU5OTkr/////Sv////9LAHRxBmJDCAgAAAAAAAAAcQeGcQhScQku\n""}
}

In Python, the following yields an error asking for a specific encoding.

pickle.loads(bytes(gANjbnVtcHkuY29yZS5tdWx0aWFycmF5CnNjYWxhcgpxAGNudW1weQpkdHlwZQpxAVgCAAAAaThxAksASwGHcQNScQQoSwNYAQAAADxxBU5OTkr/////Sv////9LAHRxBmJDCAgAAAAAAAAAcQeGcQhScQku\n))

The result should be an integer value smaller than 10. How do I decode the pickled value?

Ben L
  • 97
  • 1
  • 6

0 Answers0