Watch log

Thinker thinker at branda.to
Mon Jan 15 22:45:40 EST 2007


Salvatore Di Fazio wrote:
> Bjoern Schliessmann ha scritto:
>
>   
>> Why not read the file continuously and only do something if a new
>> line is complete (i. e.  a newline char is detected)?
>>     
>
> How can I read the file continuously?
>
>   
What you want is something like 'tail -f' in linux.
If you look into it's source code, you will find it check file periodically.
When a read() reach the end of the file, read() will return a empty string.
You can try to read data from the file periodically after a EOF.
I think it is what you want.

-- 
Thinker Li - thinker at branda.to thinker.li at gmail.com
http://heaven.branda.to/~thinker/GinGin_CGI.py




More information about the Python-list mailing list