Error when using multiprocessing module in pycharm

Answered

Whenever i use the 'import multiprocessing ' module in pycharm, it shows error in other python files i been using. I checked the code in other python compilers, and it worked fine. 

Error is as follows:

/usr/bin/python2.7 /home/faheem/PycharmProjects/untitled1/test.py
Traceback (most recent call last):
File "/home/faheem/PycharmProjects/untitled1/test.py", line 4, in <module>
import multiprocessing
File "/usr/lib/python2.7/multiprocessing/__init__.py", line 65, in <module>
from multiprocessing.util import SUBDEBUG, SUBWARNING
File "/usr/lib/python2.7/multiprocessing/util.py", line 41, in <module>
from subprocess import _args_from_interpreter_flags
File "/home/faheem/PycharmProjects/untitled1/subprocess.py", line 5, in <module>
p=subprocess.Popen(["python","tor.py"],shell=False)
AttributeError: 'module' object has no attribute 'Popen'

Process finished with exit code 1

 

subprocess.py is another python program which has no connection with the current running file test.py.

Please check and reply. Regards

0
2 comments

It seems that you have your own file called `subprocess.py` which is masking the standard library module. First, Python looks at your local modules and then go to the system ones. So in your case python found your project module `subprocess` instead of python library with the same name - that's why you got this error message.

Please, rename "/home/faheem/PycharmProjects/untitled1/subprocess.py" file and check the problem again.

0
Avatar
Permanently deleted user

Thanks a lot.. Finally found the answer... Regards

0

Please sign in to leave a comment.