I am working on an application which is in Django
. I am trying to store some data structure e.g. dictionary
in MySQL
db. So i use Python Pickle
module. It works fine when i store it in db using pickle.dumps(some_structure)
. My DB field is longblob
mode is binary
.
But when i access the field of model object in django:
obj = someModel.get(pk=1)
some_structure = obj.field
content = pickle.loads(some_structure)
it raises following error:
UnpicklingError: invalid load key, '{'.
Please help me, i have tried google but it does'nt help me, also there is one similar Question but it is not related to my problem as i am storing in db.