Ok so lets look a that little issue with pyinotify, and it really is only little, but enough to keep you on your toes. So this is the issue in brief.
START LOOP 2009-05-11 21:55:39.733393 Result of notifier.check_events() = TRUE Calling notifier.process_events() <Event dir=False mask=0x20 maskname=IN_OPEN name=foo path=/tmp pathname=/tmp/foo wd=1 > END LOOP 2009-05-11 21:55:40.339782 START LOOP 2009-05-11 21:55:40.339807 Result of notifier.check_events() = TRUE Calling notifier.process_events() <Event dir=False mask=0x4 maskname=IN_ATTRIB name=foo path=/tmp pathname=/tmp/foo wd=1 > END LOOP 2009-05-11 21:55:40.340403 START LOOP 2009-05-11 21:55:40.340426 Result of notifier.check_events() = TRUE Calling notifier.process_events() <Event dir=False mask=0x8 maskname=IN_CLOSE_WRITE name=foo path=/tmp pathname=/tmp/foo wd=1 > END LOOP 2009-05-11 21:55:40.340971
So here is the culprit notifier = pyinotify.Notifier(m, e(), 0, 0, 1000) (I’ve altered the timeout to accentuate the issue). Take a careful look at the timings between the event output lines and you can see that they are uneven. This is because the timeout isn’t a spacer, its just a wait and the events are not linearly spaced.
My error was my own of course. The lesson here is read the code through twice and check it more for design flaws.