[Twisted-Python] Using StandardIO and pipes.
andrew at bemusement.org
Thu Aug 9 22:39:08 EDT 2012
Maxim Lacrima wrote:
> So my conclusions are:
> 1. When I write to stdin of my script from keyboard then
> `self.transport.write()` works as expected.
> 2. When I use pipes or redirection to my script `self.transport.write()`
> doesn't produce any output.
> 3. If I replace self.transport.write() with print statements it works.
As a quick test, try adjusting your callback to loseConnection on the transport
after to the write, that should flush the buffers. If buffering turns out to
be your problem, and you really do expect your pipes to be at most
line-buffered, you'll need to arrange for the buffering on the stdin and stdout
file descriptors to be changed. I don't think Twisted has that builtin, so you
may need to do that before creating the StandardIO object using the regular
More information about the Twisted-Python