named pipe input

max(01)* max2 at
Thu Sep 1 21:03:27 CEST 2005

hi there.

i have some problems understanding following behaviour.

consider this:

$ cat

open MIAPIPE, "una_pipe";

while ($riga = <MIAPIPE>)
     print STDOUT ("$riga");

$ cat

import sys

MIAPIPE = open("una_pipe", "r")

for riga in MIAPIPE:
   print riga,

where una_pipe is a named pipe (created with mkfifo).

when i run this on console #1:

$ ./

and this un console #2:

$ cat > una_pipe

then each line typed in console #2 appears on console #1 as soon as the 
line is terminated (hit return).

BUT if i try to do the same with the python code, something different 
happens: i have to type ALL the lines on console #2 and complete the cat 
command (ctrl-d) before seeing the lines echoed on console #1.

i tried the -u flag but doesnt seem to work.

any help?


More information about the Python-list mailing list