questions about named pipe objects...

waltbrad waltbrad at hotmail.com
Mon Mar 17 13:50:01 EDT 2008


I'm proceeding slowly though the Lutz book "Programming Python". I'm
in the section on named pipes. The script he uses has two functions:
one for the child the other for the parent.  You start the parent then
the child:

python pipefifo.py  #starts the parent

file /tmp/pipefifo  # shows that the file is a named pipe

python pipefifo.py -child # starts a child process and writes to the
pipe.

This is done between two command windows - the first for the parent
and the second for the child.

Now, the child's write loop is infinite. So, I used Ctrl-C and stopped
the process. But the parent's read loop is also infinite and without
and exception, so it keeps reading from the pipe after the child is
shutdown even though the lines are empty. So, I had to shut that down
also.

I then wanted to start the child process first and see what happened
when I ran the parent. Well that works but the reads come out in
random order. This got me wondering about the pipe file itself. So I
tried to open it with leafpad and found that I couldn't.  I guess
these files can only be opened by processes?

Okay. But exactly when does the system brand this file as a named pipe
and how?



More information about the Python-list mailing list