PicklingError: Can't pickle <function _UTC at 0x8073549b0>: it's not the same object as pytz._UTC

163 views
Skip to first unread message

fuxter fuxter

unread,
Apr 17, 2012, 6:25:35 PM4/17/12
to django...@googlegroups.com
Hello all,

Did anybody encounter the error above after upgrading to 1.4 and switching to timezones? Some pages start 500 randomly, really randomly. I've tried switching to pickle from cPickle. I've tried changing pickle protocols in the memcached module. I've tried pylibmc. All the same. As a half measure I'm forced to use locmem for now.

Couldn't google something useful on the topic apart from problems with lazy objects with pickling.

Some info:
Django 1.4
pytz pytz==2012b
python-memcached==1.48

traceback:
   File "/home/fuxter/data/alliance/main_site/utils.py", line 132, in get_comment_by_id
     cache.set(cache_key, comment)
 
   File "/home/fuxter/data/alliance/lib/python2.7/site-packages/django/core/cache/backends/memcached.py", line 64, in set
     self._cache.set(key, value, self._get_memcache_timeout(timeout))
 
   File "/home/fuxter/data/alliance/lib/python2.7/site-packages/memcache.py", line 566, in set
     return self._set("set", key, val, time, min_compress_len)
 
   File "/home/fuxter/data/alliance/lib/python2.7/site-packages/memcache.py", line 803, in _set
     return _unsafe_set()
 
   File "/home/fuxter/data/alliance/lib/python2.7/site-packages/memcache.py", line 781, in _unsafe_set
     store_info = self._val_to_store_info(val, min_compress_len)
 
   File "/home/fuxter/data/alliance/lib/python2.7/site-packages/memcache.py", line 752, in _val_to_store_info
     pickler.dump(val)
 
   File "/usr/local/lib/python2.7/pickle.py", line 224, in dump
     self.save(obj)
 
   File "/usr/local/lib/python2.7/pickle.py", line 286, in save
     f(self, obj) # Call unbound method with explicit self
 
   File "/usr/local/lib/python2.7/pickle.py", line 649, in save_dict
     self._batch_setitems(obj.iteritems())
 
   File "/usr/local/lib/python2.7/pickle.py", line 681, in _batch_setitems
     save(v)
 
   File "/usr/local/lib/python2.7/pickle.py", line 331, in save
     self.save_reduce(obj=obj, *rv)
 
   File "/usr/local/lib/python2.7/pickle.py", line 401, in save_reduce
     save(args)
 
   File "/usr/local/lib/python2.7/pickle.py", line 286, in save
     f(self, obj) # Call unbound method with explicit self
 
   File "/usr/local/lib/python2.7/pickle.py", line 548, in save_tuple
     save(element)
 
   File "/usr/local/lib/python2.7/pickle.py", line 331, in save
     self.save_reduce(obj=obj, *rv)
 
   File "/usr/local/lib/python2.7/pickle.py", line 400, in save_reduce
     save(func)
 
   File "/usr/local/lib/python2.7/pickle.py", line 286, in save
     f(self, obj) # Call unbound method with explicit self
 
   File "/usr/local/lib/python2.7/pickle.py", line 753, in save_global
     (obj, module, name))
 
 PicklingError: Can't pickle <function _UTC at 0x8073549b0>: it's not the same object as pytz._UTC

Florian Apolloner

unread,
Jun 22, 2012, 6:16:31 AM6/22/12
to django...@googlegroups.com
Hi,

I've never ran into this and the only way I can reproduce it is: http://bpaste.net/show/29LVTwRDX5DIgUSDE6D9/ -- So my question to you is: What exactly are you doing, how are you deploying, do you have code reloading active somewhere?

Cheers,
Florian
Reply all
Reply to author
Forward
0 new messages