t.i.inotify : module documentation

Part of twisted.internet View Source

This module provides support for Twisted to linux inotify API.

In order to use this support, simply do the following (and start a reactor at some point):

   from twisted.internet import inotify
   from twisted.python import filepath

   def notify(ignored, filepath, mask):
       """
       For historical reasons, an opaque handle is passed as first
       parameter. This object should never be used.

       @param filepath: FilePath on which the event happened.
       @param mask: inotify event as hexadecimal masks
       """
       print "event %s on %s" % (
           ', '.join(inotify.humanReadableMask(mask)), filepath)

   notifier = inotify.INotify()
   notifier.startReading()
   notifier.watch(filepath.FilePath("/some/directory"), callbacks=[notify])
Present Since10.1
Function humanReadableMask Auxiliary function that converts an hexadecimal mask into a series of human readable flags.
Class INotify The INotify file descriptor, it basically does everything related to INotify, from reading to notifying watch points.
Class _Watch Watch object that represents a Watch point in the filesystem. The user should let INotify to create these objects
def humanReadableMask(mask): (source)
Auxiliary function that converts an hexadecimal mask into a series of human readable flags.
API Documentation for Twisted, generated by pydoctor at 2014-05-12 18:27:00.