I can't open a named FIFO that already exists.

Mitchell Morris mmorris at finin.morrisland.com
Thu Aug 26 20:36:38 EDT 1999


On Fri, 27 Aug 1999 00:05:43 GMT, srenner at lycosmail.com
<srenner at lycosmail.com> wrote:
[snip]
>                I want to write lines to this pipe so that another
>program (Csound) can be controlled in real time by reading events from
>it. But this object can't be opened inside Python, because neither
>os.popen('fifoname') nor open('fifoname') returns.

Actually, that's exactly the way FIFOs work in *nix-ish systems. If you open
the pipe for writing, your process will block until another process opens
it for reading. If you open for reading, you'll have to wait for someone else
to write it. They're intended for semi-anonymous rendezvous, not
store-and-forward messaging.

By the way, open() is the correct function ... it is an
unfortunate coincidence that both kinds of IPC are named 'pipes'. In fact,
FIFOs are usually called FIFOs or named pipes to avoid confusion with
socket-style pipes.



>I don't want to open a pipe inside Python, because I have to provide a
>device name to Csound on its command line, and this way it already has a
>name.
>
>I'm sure I'm missing something. Any help would be appreciated. sr

Perhaps FIFOs aren't the control mechanism you're searching for. I'm not
sure what to suggest except that the traditional method for controlling
devices at run-time is ioctl(). Maybe that will point your thinking in a
new direction.

You might also consider using message queues, since they do have the OS
support for store-and-forward operation, but that will probably require
assistance from the CSound thing.

HTH,
+Mitchell




More information about the Python-list mailing list