question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PicklingError: Can't pickle <type 'module'>: attribute lookup __builtin__.module failed

See original GitHub issue

With the latest version - when using memcache as a backend (pylibmc & python-memcache) both run into a pickling error (using django 1.9). I tried different session serializers and boiled it down to something in the DjangoSessionCacheAdapter. I now are at a point where I don’t know any more specific what the error could be.

Traceback (most recent call last): File "/home/rkessler/repositories/kollect/venv-kollect/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 235, in get_response response = middleware_method(request, response) File "/home/rkessler/repositories/kollect/venv-kollect/local/lib/python2.7/site-packages/django/contrib/sessions/middleware.py", line 50, in process_response request.session.save() File "/home/rkessler/repositories/kollect/venv-kollect/local/lib/python2.7/site-packages/django/contrib/sessions/backends/cache.py", line 55, in save return self.create() File "/home/rkessler/repositories/kollect/venv-kollect/local/lib/python2.7/site-packages/django/contrib/sessions/backends/cache.py", line 44, in create self.save(must_create=True) File "/home/rkessler/repositories/kollect/venv-kollect/local/lib/python2.7/site-packages/django/contrib/sessions/backends/cache.py", line 62, in save self.get_expiry_age()) File "/home/rkessler/repositories/kollect/venv-kollect/local/lib/python2.7/site-packages/django/core/cache/backends/memcached.py", line 78, in add return self._cache.add(key, value, self.get_backend_timeout(timeout)) File "/home/rkessler/repositories/kollect/venv-kollect/local/lib/python2.7/site-packages/memcache.py", line 673, in add return self._set("add", key, val, time, min_compress_len, noreply) File "/home/rkessler/repositories/kollect/venv-kollect/local/lib/python2.7/site-packages/memcache.py", line 1060, in _set return _unsafe_set() File "/home/rkessler/repositories/kollect/venv-kollect/local/lib/python2.7/site-packages/memcache.py", line 1034, in _unsafe_set store_info = self._val_to_store_info(val, min_compress_len) File "/home/rkessler/repositories/kollect/venv-kollect/local/lib/python2.7/site-packages/memcache.py", line 998, in _val_to_store_info pickler.dump(val) PicklingError: Can't pickle <type 'module'>: attribute lookup __builtin__.module failed

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kolibercommented, Mar 23, 2017

Issue seems to be on the self._set_objects(self) line in DjangoSessionCacheAdapter. I am experiencing it with a Redis cache backend.

0reactions
homedawncommented, Feb 13, 2019

@sheepsy90 I had the same problem,when I use multiprocessing.pool.map(func, iterable),and iterable has one class instance in tensorflow fram

Read more comments on GitHub >

github_iconTop Results From Across the Web

pickle.PicklingError: Can't pickle <class 'module'>: attribute ...
Code running in processes created with multiprocessing runs in a separate process from the process which created it. As such, it cannot access ......
Read more >
Can't pickle <type 'module'>: attribute lookup __builtin__ ...
With the latest version - when using memcache as a backend (pylibmc & python-memcache) both run into a pickling error (using django 1.9)....
Read more >
PicklingError in pyspark (PicklingError: Can't pickle <class ...
The problem is that you're trying to pickle an object from the module where it's ... is not the error you are getting...
Read more >
The Python pickle Module: How to Persist Objects in Python
PicklingError : Can't pickle <function <lambda> at 0x10cd52cb0>: attribute lookup <lambda> on __main__ failed. Now try replacing the Python pickle module ...
Read more >
Can't pickle <type 'function'> - Lemma Soft Forums
HIGHEST_PROTOCOL) PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed. and I got another error, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found