files in non-blocking mode?
Uwe Mayer
merkosh at hadiko.de
Sun Nov 28 10:47:35 EST 2004
Sunday 28 November 2004 14:49 pm Mathias Waack wrote:
> Uwe Mayer wrote:
>> 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?
Yes, I used
line = stdin.readline()
and made sure the sending client had a newline ("\n") char appended to the
text. Still, the receiving client's readline() function does not return.
Uwe
More information about the Python-list
mailing list