Check File Change Every 10 Seconds
Robert Rawlins - Think Blue
robert.rawlins at thinkbluemedia.co.uk
Mon Oct 22 16:46:51 CEST 2007
Spot on Tim, I'm running Linux, I totally forgot to mention... more detail coming in a reply to Gabriel's post.
From: python-list-bounces+robert.rawlins=thinkbluemedia.co.uk at python.org [mailto:python-list-bounces+robert.rawlins=thinkbluemedia.co.uk at python.org] On Behalf Of Tim Golden
Sent: 22 October 2007 15:40
Cc: python-list at python.org
Subject: Re: Check File Change Every 10 Seconds
Gabriel Genellina wrote:
> En Mon, 22 Oct 2007 06:56:52 -0300, Robert Rawlins - Think Blue
> <robert.rawlins at thinkbluemedia.co.uk> escribi�:
>> I've got a requirement to check a file for a change every 10 seconds or
>> and if the file has been modified since the last time I parsed its
>> into the application then I need to parse it in again. However, I need
>> process to not interrupt the rest of my application flow.
> See this article by Tim Golden:
>> What is the best way to handle this? Is there some form of file watcher
>> module for python which can watch the file for me and then parse any
>> into the application memory? Or should I be spawning and unjoined thread
>> which contains and infinite loop which checks a date/time the file was
>> modified against an internal date/time variable for when the application
>> last parsed the file into memory?
> I would use a different thread waiting for notifications from
> ReadDirectoryChangesW (third option in the link above)
> See http://msdn2.microsoft.com/en-us/library/aa365465.aspx for more info
> on ReadDirectoryChangesW
Although Robert doesn't say so here, I seem to remember that his
past posts have indicated a *nix setting. Robert?
More information about the Python-list