How to write to a named pipe?

singlets at singlets at
Mon Aug 16 07:31:43 CEST 1999

Could someone help me with a basic thing?  I have
an external application that reads from a named
pipe and then processes the information from said
pipe.  I'd like to send this info from my python
app.  I can create the named pipe with mkfifo()
just fine.  Reading the docs, I gather that this
only creates the pipe and I must then treat the
pipe as a file. But when I go to access the "file"
(really the pipe), python just hangs.  Really
hangs, i.e., no control-c or control-d stopping.
Here is my simple ditty:

%: python
Python 1.5.1 (#1, Mar 21 1999, 22:49:36)  [GCC
egcs-2.91.66 19990314/Li on linux-i386
Copyright 1991-1995 Stichting Mathematisch
Centrum, Amsterdam
>>> import os
>>> os.mkfifo('/tmp/myfifo')
>>> f=open('/tmp/myfifo','w')    # now we're stuck

I've checked permissions, should be ok.  I've also
tried making the pipe with world rw permissions
from a prompt, then accessing this pipe from
python in the same manner as above.  Same result.
No errors raised, so I assume it's trying to
connect to the pipe.  As you can see, I'm running
python 1.5.1 on a stock RedHat 6 linux Intel box.
Sorry if I'm being an idiot.


Sent via
Share what you know. Learn what you don't.

More information about the Python-list mailing list