I have spent multiple hours trying to figure out how to pass multiple parameters to python script which is supposed to be executed by subprocess.Popen without any luck.
Script:
command = ['/usr/bin/python', '/tmp/script.py mcl=NULL mtp=data mnm=DS4INST \
mno=NULL mse=NULL mce=cll01']
result = subprocess.Popen(command, stdout = subprocess.PIPE, \
stderr = subprocess.PIPE)
out, err = result.communicate()
print out, err
I receive following error message:
python: can't open file '/tmp/script.py mcl=NULL mtp=data mnm=DS4INST mno=NULL \
mse=NULL mce=cll01': [Errno 2] No such file or directory
However, when I execute script directly from shell
/usr/bin/python /tmp/script.py mcl=NULL mtp=data mnm=DS4INST mno=NULL \
mse=NULL mce=cll01
I receive desired output and error message isn't generated.
Please advise.