user2470472
user2470472

Reputation: 3

Python subprocess module to invoke a program and give it input

i am using python 2.7.4 and need help to call a program kendall.exe kendall.exe uses two inputs which it asks from the console(displaying its messages and reading input). i have to do this through a python program using the subprocess module. using the Popen function, the program opens but i cannot pass it input, neither does it produce its output(no question of it). here is what i have till now:

string="/Kendall/mann-kendall/Kendall.exe"
process=subprocess.Popen(string,stdin=subprocess.PIPE,stdout=subprocess.PIPE);
smsc=process.stdout.read()
process.stdout.write(file_1+"\n")
smsc=process.stdout.read()
process.stdout.write(file_2+"\n"+"\n")
p=process.wait();

Upvotes: 0

Views: 123

Answers (1)

glglgl
glglgl

Reputation: 91017

process.stdout.write(...)

? ITYM

process.stdin.write(...)

as, if you want to send data to that program, it gets them via its stdin...

Upvotes: 1

Related Questions