files in non-blocking mode?
Jean Brouwers
mrjean1ATcomcastDOTnet at no.spam.net
Sun Nov 28 12:35:03 EST 2004
Try setting the unbuffered mode for the spawned process by using
"python -u ./amc/amc.py"
/Jean Brouwers
In article <cocrun$qqu$1 at news2.rz.uni-karlsruhe.de>, Uwe Mayer
<merkosh at hadiko.de> wrote:
> 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