Opened 9 years ago

Last modified 6 years ago

#10865 closed

Unable to pickle Queryset — at Initial Version

Reported by: wfagan@… Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I am getting an error while trying this code. I am using memcached as my backend. It looks like it isn't able to correctly pickle the queryset. This article makes me think it should be able to pickle them... http://docs.djangoproject.com/en/dev/ref/models/querysets/#pickling-querysets

places = Place.objects.all()
cache.set("places", pickle.dumps(places))
c = cache.get("places")
pickle.loads(c)

Traceback (most recent call last):

File "<console>", line 1, in <module>
File "/usr/lib/python2.6/pickle.py", line 1374, in loads

return Unpickler(file).load()

File "/usr/lib/python2.6/pickle.py", line 858, in load

dispatch[key](self)

File "/usr/lib/python2.6/pickle.py", line 1090, in load_global

klass = self.find_class(module, name)

File "/usr/lib/python2.6/pickle.py", line 1124, in find_class

import(module)

TypeError: import() argument 1 must be string without null bytes, not str

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top