[IPython-dev] Anyone done anything like this before?
Tue Oct 2 15:45:46 CDT 2012
On 10/02/2012 16:42, Thomas Kluyver wrote:
> On 2 October 2012 20:47, Aron Ahmadia <email@example.com> wrote:
>> Absolutely, you want the subprocess module, and in particular, the
>> subprocess.communicate() method.
> I'm not sure that that is the best thing here. The docs for
> communicate() say "...Wait for process to terminate...", whereas it
> sounds like David wants to repeatedly communicate with a process.
> I'm not entirely sure from the description, but I'd point you to
> pexpect, which is designed to wait for particular output patterns
> a process and respond with input.
> IPython-dev mailing list
I ran into that problem before. If you don't want to wait for it to
terminate you can use the IO pipes directly instead. Select on the STDIN
or STDOUT that you get from the popen call and use those to communicate
with the process.
More information about the IPython-dev