How to write to a named pipe?

Diego Dainese xdsi at xddainese.unive.it
Tue Aug 17 18:08:12 EDT 1999


singlets at my-deja.com writes:
[snip]
> %: 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
[snip]

It is normal that Python hangs when you try to open the fifo for
writing, because the underlying C sys-call hangs waiting for some
process to open the pipe for reading.

The problem is that when Python hangs, it cannot receive signals; I
had the very same problem with the threading API, and the only
solution I found was to do polling.

Does anyone known a better solution?

> Sorry if I'm being an idiot.
> 

I'm sorry too ;)

Bye,

-- 
Diego   | To reply remove the `x' and swap the | Sorry for my
Dainese | words around the `@' in the address. | bad English!




More information about the Python-list mailing list