select() on pipe
Brad Murdoch
brad at it.alliedpress.co.nz
Mon Apr 25 19:50:07 EDT 2005
im trying to run the select.selct() on a unix pipe, my expectation is
that it will block untill there is something there to read, then
continue. It seems to do this untill the pipe is written to once, then i
get a busy while loop.
shouldnt this stop each time, to wait for something to be written to
the pipe. obviously im a novice when it comes to python programming,
what am i missing here.
cheers..
#!/usr/bin/python
import os
import sys
import select
try:
fifo = open('test.fifo','r')
except Exception, blah:
report = "ERROR 001: " + str(blah)
print report
sys.exit(2)
while 1:
line = False
r,w,x = select.select([fifo],[],[])
if r:
line=fifo.read()
print line
More information about the Python-list
mailing list