Stack Exchange
class ForkAwareLocal(threading.local): AttributeError: 'module' object has no attribute 'local
I'm a python newbie.
Am trying this code snippet from the manual, but am getting this error.
Cannot figure out why.
Any help will be appreciated.
Thx
Abhi
code snippet
#/usr/bin/python
# -*- coding: utf-8 -*-

from multiprocessing import Pool
def f(x):
return x*x

p = Pool(1)
p.map(f, [1, 2, 3])


Error
[root@localhost mpls-perf]# python thr_1.py 
Traceback (most recent call last):
  File "thr_1.py", line 4, in <module>
    from multiprocessing import Pool
  File "/usr/lib64/python2.7/multiprocessing/__init__.py", line 65, in <module>
    from multiprocessing.util import SUBDEBUG, SUBWARNING
  File "/usr/lib64/python2.7/multiprocessing/util.py", line 340, in <module>
    class ForkAwareLocal(threading.local):
AttributeError: 'module' object has no attribute 'local'
Exception AttributeError: '_shutdown' in <module 'threading' 
from '/root/nfs/zebos/tests/mpls-             perf/threading.pyc'> ignored


OS etc
[root@localhost mpls-perf]# uname -a
Linux localhost.localdomain 3.4.4464bit-smp-xp1.1-allpatch #1 SMP Wed Oct 15 17:34:02 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost mpls-perf]# python -V
Python 2.7.5
[root@localhost mpls-perf]

You appear to have a file called threading.py
This is being imported instead by multiprocessing instead of the builtin threading
rename your file to something else and delete the .pyc
