module documentation
(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])
    notifier.watch(filepath.FilePath(b"/some/directory2"), callbacks=[notify])

Note that in the above example, a FilePath which is a bytes path name or str path name may be used. However, no matter what type of FilePath is passed to this module, internally the FilePath is converted to bytes according to sys.getfilesystemencoding. For any FilePath returned by this module, the caller is responsible for converting from a bytes path name to a str path name.

Present Since
10.1
Class INotify The INotify file descriptor, it basically does everything related to INotify, from reading to notifying watch points.
Function humanReadableMask Auxiliary function that converts a hexadecimal mask into a series of human readable flags.
Variable IN_ACCESS Undocumented
Variable IN_ATTRIB Undocumented
Variable IN_CHANGED Undocumented
Variable IN_CLOSE Undocumented
Variable IN_CLOSE_NOWRITE Undocumented
Variable IN_CLOSE_WRITE Undocumented
Variable IN_CREATE Undocumented
Variable IN_DELETE Undocumented
Variable IN_DELETE_SELF Undocumented
Variable IN_DONT_FOLLOW Undocumented
Variable IN_IGNORED Undocumented
Variable IN_ISDIR Undocumented
Variable IN_MASK_ADD Undocumented
Variable IN_MODIFY Undocumented
Variable IN_MOVE_SELF Undocumented
Variable IN_MOVED Undocumented
Variable IN_MOVED_FROM Undocumented
Variable IN_MOVED_TO Undocumented
Variable IN_ONESHOT Undocumented
Variable IN_ONLYDIR Undocumented
Variable IN_OPEN Undocumented
Variable IN_Q_OVERFLOW Undocumented
Variable IN_UNMOUNT Undocumented
Variable IN_WATCH_MASK Undocumented
Class _Watch Watch object that represents a Watch point in the filesystem. The user should let INotify to create these objects
Variable _FLAG_TO_HUMAN Undocumented
def humanReadableMask(mask): (source)
Auxiliary function that converts a hexadecimal mask into a series of human readable flags.
IN_ACCESS: int = (source)

Undocumented

IN_ATTRIB: int = (source)

Undocumented

IN_CHANGED = (source)

Undocumented

IN_CLOSE = (source)

Undocumented

IN_CLOSE_NOWRITE: int = (source)

Undocumented

IN_CLOSE_WRITE: int = (source)

Undocumented

IN_CREATE: int = (source)

Undocumented

IN_DELETE: int = (source)

Undocumented

IN_DELETE_SELF: int = (source)

Undocumented

IN_DONT_FOLLOW: int = (source)

Undocumented

IN_IGNORED: int = (source)

Undocumented

IN_ISDIR: int = (source)

Undocumented

IN_MASK_ADD: int = (source)

Undocumented

IN_MODIFY: int = (source)

Undocumented

IN_MOVE_SELF: int = (source)

Undocumented

IN_MOVED = (source)

Undocumented

IN_MOVED_FROM: int = (source)

Undocumented

IN_MOVED_TO: int = (source)

Undocumented

IN_ONESHOT: int = (source)

Undocumented

IN_ONLYDIR: int = (source)

Undocumented

IN_OPEN: int = (source)

Undocumented

IN_Q_OVERFLOW: int = (source)

Undocumented

IN_UNMOUNT: int = (source)

Undocumented

IN_WATCH_MASK = (source)

Undocumented

_FLAG_TO_HUMAN = (source)

Undocumented