I'm trying to pipe input to a program opened as a subprocess in Python. Using communicate() does what I want, but it only does so once, then waits for the subprocess to terminate before allowing things to continue.
Is there a method or module similar to communicate() in function, but allows multiple communications with the child process?
Here's an example:
import subprocess
p = subprocess.Popen('java minecraft_server.jar',
shell=True,
stdin=subprocess.PIPE);
//Pipe message to subprocess' console here
//Do other things
//Pipe another message to subprocess' console here
If this can be done in an easier fashion without using subprocess, that would be great as well.