Reputation: 439
So I've looked a bit into the subprocess library, and I think that it is the right library to use, but I can't seem to find out how one would go about passing input to the program during runtime. I want to run a jar using a python script and analyze the output of that jar file while it is running (for an indefinite amount of time). Then, based on that output, I want to be able to pass back input to the jar file (which is accepting input).
Upvotes: 1
Views: 2552
Reputation: 1638
You will need to use the subprocess.Popen constructor, passing as stdin and stdout arguments either:
There are some nice examples at http://sharats.me/the-ever-useful-and-neat-subprocess-module.html
Upvotes: 1