Creating an event loop

Larry Bates larry.bates at websafe.com
Mon Apr 10 09:30:08 EDT 2006


Fabian Steiner wrote:
> Hello!
> 
> I am currently wondering how to write something like an "event loop".
> For example, if I want to write a function that checks whether a file
> was added or removed in a directory I would think of a "while 1: ..."
> construct that checks the mtime of the directory. Is this the right way
> to achieve the exepected result or are there any better ways?
> 
> Cheers,
> Fabian

You didn't mention what platform you were working on.  Google turns up
the following items.

These links might be beneficial if it is Windows:

http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html


If it is Linux:

http://pyinotify.sourceforge.net/

-Larry Bates



More information about the Python-list mailing list