wait until change

Peter Hansen peter at engcorp.com
Fri Oct 17 12:53:39 EDT 2003


Tom wrote:
> 
> I have the following problem. I analyse data from a file. When I am done
> analysing all the data that was in that file, I want to let my program
> wait until this specific file has changed (which indicates that new data
> has been added to the file from a third party program that I don't
> control). If that file has changed, I want my program to continue.

Would it be sufficient to have your program periodically wake up and
check the timestamp on the file?  To do that, a combination of time.sleep()
and os.stat() would be sufficient, and quite cross-platform.

-Peter




More information about the Python-list mailing list