Tail...

Alex Martelli aleaxit at yahoo.com
Mon May 7 08:56:00 EDT 2001


"Magnus Heino" <magnus.heino at rivermen.se> wrote in message
news:9d61t8$qed$1 at taliesin.netcom.net.uk...
>
> How can I know if a file changes?
>
> Just like the tail command, I want to know when lines are added to a file,
> and be able to read them.
>
> My first thougt was to use select or something, but I dont get it to work.
> If I register on POLLIN I get events all the time... :-P

It does somewhat depend on the underlying operating system.

If you want a cross-platform solution, I think you have
to check periodically if anything new and interesting has
happened to the file -- there is, AFAIK, no portable,
cross-platform way in which you can be automatically
alerted to such events.


Alex






More information about the Python-list mailing list