I am working on an application that is in Django. I am trying to save some data structure e.g. dictionaryin MySQLdb. Therefore, I use the Python module Pickle. It works great when I store it in db using pickle.dumps(some_structure). My DB field longblobis binary.
But when I access the field of the model object in django:
obj = someModel.get(pk=1)
some_structure = obj.field
content = pickle.loads(some_structure)
it causes the following error:
UnpicklingError: invalid load key, '{'.
Please help me, I tried Google, but it does not help me, there is also one similar Question , but this is not related to my problem, since I store in db.
source
share