when I execute the following function in centos, I get the error
def install_requests_lib():
try:
import requests
return
except ImportError, e:
print "module does not exist, installing..."
if(platform.system().lower()=='darwin'):
print "install requests before proceeding, run **sudo pip install requests**"
sys.exit(2)
elif(platform.system().lower()=='linux'):
print "installing"
p=Popen(["yum","-y","install","python-requests"], stdout=PIPE, shell=True)
p.communicate()
print p.returncode
error:
module does not exist, installing...
installing
You need to give some command
1
I cannot figure out what is wrong.
I executed with stdin=PIPE
argument, still I get the same error.