Gol
Gol

Reputation: 1

Getting error with importing multiprocess in python2.7

I am trying to use multiprocessing in python2.7 but when I import multiprocess it gave me below error:

Traceback (most recent call last):
  File "threading.py", line 25, in <module>
    import multiprocess
  File "C:\Python27\lib\site-packages\multiprocess\__init__.py", line 65, in 
<module>
    from multiprocess.util import SUBDEBUG, SUBWARNING
  File "C:\Python27\lib\site-packages\multiprocess\util.py", line 349, in 
<module>
    class ForkAwareLocal(threading.local):
AttributeError: 'module' object has no attribute 'local'
Exception AttributeError: "'module' object has no attribute '_shutdown'" in 
<module 'threading' from 'C:\Users\gjavadi\Documents\P
   yhton_workspace\threading.py'> ignored

my code is basically just one line:

import multiprocess

I installed the package using 'pip install multiprocess'. Could you please help me to figure out this problem?

Upvotes: 0

Views: 100

Answers (2)

Gol
Gol

Reputation: 1

I finally figured out my problem. The problem was about having the same file name as python. I named my file 'threading.py' which python has a file with the same name.

Upvotes: 0

Ivan Zaqqa
Ivan Zaqqa

Reputation: 31

You can try this:

>>> import atexit
>>> atexit.__file__  # should display a similar path for you        
    'C:\\python27\\lib\\atexit.pyc'
>>> dir(atexit)  # should display the same list, including "register"
    ['__all__', '__builtins__', '__doc__', '__file__', '__name__', 
    '__package__', '_exithandlers', '_run_exitfuncs', 'register', 
    'sys']

It looks like your atexit module got damaged. Fixing that may just be a matter of deleting atexit.pyc (if it exists).

~Tim Peters

Upvotes: 1

Related Questions