R
Rajarshi Guha
Hi,
I'm having a little trouble when I read from a named pipe. I create a
pipe by
os.mkfifo('/tmp/mypipe')
and then open it for reading with
fin = open('/tmp/mypipe','r+')
(I don't use 'r' as that cause the open command to block). However when I
do from another terminal:
ls -l /tmp/mypipe
and then from my Python session do:
fin.readlines()
it just hangs and I have to Ctrl-C to get out. But when I do from a
terminal:
ls -l /tmp/mypipe ; cat < /tm/mypipe
I get the output of the ls command. Why does'nt Python read from the pipe
when some other program writes to it?
Thanks,
Rajarshi
I'm having a little trouble when I read from a named pipe. I create a
pipe by
os.mkfifo('/tmp/mypipe')
and then open it for reading with
fin = open('/tmp/mypipe','r+')
(I don't use 'r' as that cause the open command to block). However when I
do from another terminal:
ls -l /tmp/mypipe
and then from my Python session do:
fin.readlines()
it just hangs and I have to Ctrl-C to get out. But when I do from a
terminal:
ls -l /tmp/mypipe ; cat < /tm/mypipe
I get the output of the ls command. Why does'nt Python read from the pipe
when some other program writes to it?
Thanks,
Rajarshi