[Twisted-Python] Two thumbs up for inotify.py

David Ripton dripton at ripton.net
Fri Dec 19 14:38:32 EST 2008

I just tried the latest inotify.py from dialtone's sandbox, and I like

My application is a little PyGTK / Cairo recording data scope (closed
source) that needs to read lots of little files and plot lots of data
points in realtime.

I have my own inotify/ctypes wrapper (at the time I wrote it I found two
Python inotify wrappers; one was GPL and the other didn't work for me)
which works okay in this application.  But it's a bit gross because my
call to see if there are any inotify events is blocking (with a very
short timeout), rather than truly event-based.

To try inotify.py, I Twistified my code (easy because it was already
event-driven PyGTK), then changed all the inotify calls to use the
sandbox module's API rather than mine.  The only thing I disliked about
the API was having to pass the callbacks are to the watch method, rather
than the watch method returning a Deferred that I could addCallback on,
but that's just different, not actually hard or confusing.

Anyway, it works and my code is a bit smaller and cleaner than it was
before and uses a tad less CPU.  I hope this ends up in a Twisted
release.  I see #972 in the tracker, but it's been untouched for a
long time.  Should I comment there?


David Ripton    dripton at ripton.net

More information about the Twisted-Python mailing list