On Apr 24, 3:38 am, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2008-04-23, blaine <[EMAIL PROTECTED]> wrote: > > > On Apr 23, 2:01 pm, "Martin Blume" <[EMAIL PROTECTED]> wrote: > >> "blaine" schrieb > >> No, > >> while 1: > >> r = self.fifodev.readline() > >> if r: print r > >> else: time.sleep(0.1) > >> is ok (note the "if r:" clause). > > >> Martin > > > Beautiful! Thanks Martin! > > yes, but you have to follow the usual file handling rules, and close/re-open > the fifo after detecting EOF. You will be blocked on attempting to re-open > until there is another writing process. > > while 1: > fp = open('my_fifo', 'r') > while 1: > line = fp.readline() > if line == '': > break > print line.rstrip() # To prevent printing of \n in line > fp.close() > > Albert
Oh, good call. Thanks a lot, that really helps. I felt that the previous solution was workable, but not perhaps 100% correct. Thanks Albert! -- http://mail.python.org/mailman/listinfo/python-list