Check File Change Every 10 Seconds

Robert Rawlins - Think Blue robert.rawlins at thinkbluemedia.co.uk
Mon Oct 22 05:56:52 EDT 2007


Hello Chaps,

 

I've got a requirement to check a file for a change every 10 seconds or so,
and if the file has been modified since the last time I parsed its content
into the application then I need to parse it in again. However, I need this
process to not interrupt the rest of my application flow.

 

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 changes
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'll be interested to hear your ideas guys,

 

Thanks,

 

Rob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071022/3f4ce362/attachment.html>


More information about the Python-list mailing list