how to flush child_stdin
joelcarrier at gmail.com
joelcarrier at gmail.com
Fri Feb 22 11:35:03 EST 2008
On Feb 22, 12:15 am, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
> On Thu, 21 Feb 2008 12:34:28 -0800 (PST), "joelcarr... at gmail.com"
> <joelcarr... at gmail.com> declaimed the following in comp.lang.python:
>
>
>
> > I'm opening up a subprocess like this where slave.py is a text based
> > app that receives commands and responds with output:
>
> > r, w, e = popen2.popen3('python slave.py')
>
> > I need to send slave.py a command and see the output,
> > so I'll do something like:
>
> > w.write("command here")
> > then i'll try this:
> > w.flush()
>
> > A separate thread is reading from r to retrieve output of slave.py.
>
> > The problem is that slave.py doesn't seem to receive commands unless I
> > also do:
> > w.close()
>
> What happens if you do:
>
> w.write("command here\n")
> w.flush()
>
> Could the slave be blocked waiting for an EOL character before
> processing said command?
> --
> Wulfraed Dennis Lee Bieber KD6MOG
> wlfr... at ix.netcom.com wulfr... at bestiaria.com
> HTTP://wlfraed.home.netcom.com/
> (Bestiaria Support Staff: web-a... at bestiaria.com)
> HTTP://www.bestiaria.com/
I don't think that is the problem, I'm feeding it newline characters.
More information about the Python-list
mailing list