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

James Logajan JamesL at Lugoj.Com
Fri Aug 27 01:37:47 EDT 1999


srenner at lycosmail.com wrote:
> 
> I have an object in my Linux filesystem that I created with 'mkfifo'. I
> suppose it's called a FIFO. Anyway, the idea is to use it as a pipe. It
> already exists. 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.
> 
> 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
> 
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

You need to do:

f = open("fifoname", "w+")

or:

f = open("fifoname", "r+")

As noted by Mitchell Morris, a pipe needs a reader and a writer. So opening
read/write, read/update, or write/update solves the blocking problem.
Fortunately you don't have to then do both operations from one end. Hope
this helps.




More information about the Python-list mailing list