files in non-blocking mode?

Mathias Waack M.Waack at gmx.de
Sun Nov 28 14:49:18 CET 2004


Uwe Mayer wrote:

> Hi,
> 
> I want two python programs to communicate over stdIO channels. The
> one executes the other via the popen3 function:
> 
> amc = Popen3("./amc/amc.py", True, 0)
> line = stdin.readline()
> amc.tochild.write(line)
> amc.tochild.flush()
> print amc.fromchild.readlines()
> 
> The problem is that although amc.tochild gets flushed the data
> never reaches the client until the .tochild fd is closed. Is there
> any way to put IO channels into non-blocking mode in python?

How do you read the data in the client? Maybe you're using a line
buffered read? Does your code work if the server includes a trailing
CR and/or NL in the string before it calls the flush?

Mathias



More information about the Python-list mailing list