[Tutor] named pipe problem

Kent Johnson kent37 at tds.net
Wed Aug 20 22:53:51 CEST 2008


On Wed, Aug 20, 2008 at 3:54 PM, dave selby <dave6502 at googlemail.com> wrote:
> Hi All,
>
>
> I am trying to get a named pipe working, I have already made a fifo
>
> dave at dev-system:/usr/local/bin$ ls -al /home/dave/kmotion2/www/pipe_func
> prw-rw---- 1 dave www-data 0 2008-08-20 20:25 /home/dave/kmotion2/www/pipe_func
> dave at dev-system:/usr/local/bin$
>
> but when I execute my test code to add an item to the fifo ...
>
>    func = '199'
>    www_dir = '/home/dave/kmotion2/www'
>    print '%s/pipe_func' % www_dir
>    pipeout = os.open('%s/pipe_func' % www_dir, os.O_WRONLY)
>    print 'xxx'
>    os.write(pipeout, func)
>    os.close(pipeout)
>
> I get the path printed out & then the script hangs silently on pipeout
> = os.open('%s/pipe_func' % www_dir, os.O_WRONLY)
>
> Can anyone tell me why ? I expected it to return immediately

See this informative thread:
http://mail.python.org/pipermail/python-list/2006-August/396499.html

Summary: opening a pipe for write blocks until it is also opened for read.

Kent


More information about the Tutor mailing list