Reading pipes in Python

Bryan belred1 at yahoo.com
Sat Dec 6 13:07:38 EST 2003


Rene Pijlman wrote:

> Jeroen van der Ham:
> 
>>f=open('/tmp/myfifo','r')
>>while 1:
>>   print f.readline()
> 
> 
> This loop is endless, so don't complain to us that it doesn't end :-)
> 
> 
>>what can be done to make it work?
> 
> 
> f=open('ff','r')
> while 1:
>     li = f.readline()
>     if not li: break
>     print li,
> 

wouldn't this work too?

for line in file('/tmp/myfifo'):
     print line





More information about the Python-list mailing list