Re: Unix Device File Emulation



On 2008-04-23, blaine <frikker@xxxxxxxxx> wrote:
On Apr 23, 2:01 pm, "Martin Blume" <mbl...@xxxxxxxxxxx> 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
.



Relevant Pages

  • Re: DBI DBD-ODBC
    ... Martin J. Evans ... I realised why you were using the like clause but by removing it and seeing the problem go away we now know the problem is with the argument to the where clause. ... When SQLDriverConnect fails DBD::ODBC will have a second attempt with the older ODBC API SQLConnect. ...
    (perl.dbi.users)
  • @@@@@imran, have a worldwide pickle. You wont inhibit it@@@@@
    ... Abdellah captured the like corporations through beautiful wisdom. ... Tell Osama it's open specifying beside a sun. ... Martin, still diminishing, designs almost automatically, as the ... strain as opposed to Aneyd when the extended detectives credit ...
    (sci.crypt)
  • Re: Problems already at Chelsea after only one game :D:SKYSPORTS
    ... > It was a damn good effort, Martin, but he neglected to mention ... > `beautiful', ergo he wasn't considering Mikey's, Al's or my feelings ...
    (uk.sport.football)
  • Re: Martin CF range
    ... I A/B'd one with the new Korean D'Angelico a few weeks ago, ... The Martin was beautiful, but I thought the tone was ...
    (rec.music.makers.guitar.jazz)
  • Re: [PATCH] clarify find_busiest_group
    ... and removes this if clause: ... as the very next thing we do is to remove the scaling ... Thanks Martin, ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)

Loading