I am new to python and not knowing whats going on here. I have tried searching a lot but had to end up asking here
I am trying to learn subprocess which executes a simple command as:
import subprocess
subprocess.call(['ls'])
Now, when I run the program I get this error:
Traceback (most recent call last):
File "subprocess.py", line 1, in <module>
import subprocess
File "/task/subprocess.py", line 2, in <module>
subprocess.call(['ls'])
AttributeError: 'module' object has no attribute 'call'
You called your file subprocess.py
, change then name and you will be ok. You are trying to import from your file and not the module
ldap-new:~ # rm -rf subprocess.pyc
This worked for me i just removed .pyc file and run again
Regards, -Mansur
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.