Re: Unix Device File Emulation
- From: "A.T.Hofkamp" <hat@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 24 Apr 2008 09:38:16 +0200
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
.
- Follow-Ups:
- Re: Unix Device File Emulation
- From: blaine
- Re: Unix Device File Emulation
- References:
- Re: Unix Device File Emulation
- From: blaine
- Re: Unix Device File Emulation
- From: Martin Blume
- Re: Unix Device File Emulation
- From: blaine
- Re: Unix Device File Emulation
- From: Martin Blume
- Re: Unix Device File Emulation
- From: blaine
- Re: Unix Device File Emulation
- Prev by Date: Re: library to do easy shell scripting in Python
- Next by Date: Re: python-ldap - Operations Error
- Previous by thread: Re: Unix Device File Emulation
- Next by thread: Re: Unix Device File Emulation
- Index(es):
Relevant Pages
|
Loading