I'm trying to write a python script that starts a subprocess, and writes to the subprocess' stdin.
Here I can write and get a result:
def get_band():
print "band"
p = subprocess.Popen(["/path/to/program","-c","-"], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
ran_stdout = p.communicate(input='show status')[0]
print(ran_stdout)
However the print statement gives:
Unable to connect at 127.0.0.1, Connection refused.
If I do this the same result is displayed:
p = subprocess.Popen(["/path/to/program","-c","-"], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
print p[0]
If I run this command from a terminal it works fine, I can get the result back.
What is wrong with the parameters given?
["/path/to/program","-c","-"]