from http://schettino72.wordpress.com/tag/inotify/
I am working on adding some inotify goodness to doit. For that I want to receive one, and one only, notification every time a file is modified. Inotify makes the hard work of watching the file system and Pyinotify provides a python interface. But using it was not straight-forward as I expected. The problem is that editors manipulate files on its own ways…
It worked fine when I used “echo”. But than when I tried with Emacs I got 3 notifications. With VIM it was even worst, I got no notifications and an error message!
Getting the excelent example of phihag
wm.add_watch('file.watched', pyinotify.IN_MODIFY, onChange)
could be:
wm.add_watch('file.watched', pyinotify.IN_CLOSE_WRITE, onChange)