when I execute the following function in centos, I get error
except ImportError, e:
print "module does not exist, installing..."
print "install requests before proceeding, run **sudo pip install requests**"
p=Popen(["yum","-y","install","python-requests"], stdout=PIPE, shell=True)
module does not exist, installing...
You need to give some command
The arguments in your arg list after
"yum" aren't being executed if you give the argument
shell=True. Remove the
shell=True argument and it should work.
Alternatively, you could supply the full command line as a string and keep the
p=Popen("yum install -y python-requests", stdout=PIPE, shell=True)
but it's generally discouraged to do so, for many reasons.