Interacting with Subprocesses

Terry Reedy tjreedy at udel.edu
Wed May 4 20:33:56 EDT 2016


On 5/4/2016 2:41 PM, Dick Holmes wrote:
> I am attempting to write a Python program that will interact with
> a (non-Python) process. The programs will run under MinGW. The
> process can use stdin/stdout commands and responses and can work
> with pipes. The problem I'm having is that I can't find any
> way in Python to have a continuing dialog with the process. I
> have tried Popen communicate, but that protocol seems to be
> limited to a single message/response pair, and the response
> is not returned to the message originator until the process
> terminates. Unfortunately I don't have access to the process'
> source code so I can't change the communication medium.
>
> Is there some feature that will allow me to initiate the process
> and execute multiple message/response pairs between the Python
> program and the process during a single execution of the process?

I have been told that multiprocessing works better for this.  Not sure 
is true.

-- 
Terry Jan Reedy




More information about the Python-list mailing list