I am trying to pass input to a program open as a subprocess in Python. Using the communication () function does what I want, but it does it only once, and then waits for the subprocess to complete before allowing it to continue.
Is there a method or module similar to the communication () function in a function, but allows multiple communication with the child process?
Here is 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 easier without using a subprocess, that would be great too.
python subprocess communication
Sean
source share