Module inotifyx
[hide private]
[frames] | no frames]

Module inotifyx

source code

inotifyx is a simple Python binding to the Linux inotify file system event monitoring API.

Generally, usage is as follows:

>>> fd = init()
>>> try:
...     wd = add_watch(fd, '/path', IN_ALL_EVENTS)
...     events = get_events(fd)
...     rm_watch(fd, wd)
... finally:
...     os.close(fd)
Classes [hide private]
  InotifyEvent
InotifyEvent(wd, mask, cookie, name)
Functions [hide private]
 
get_events(fd, timeout=...)
Return a list of InotifyEvent instances representing events read from inotify.
source code
Variables [hide private]
  constants = {'IN_ACCESS': 1, 'IN_ALL_EVENTS': 4095, 'IN_ATTRIB...
  IN_ACCESS = 1
  IN_ALL_EVENTS = 4095
  IN_ATTRIB = 4
  IN_CLOSE = 24
  IN_CLOSE_NOWRITE = 16
  IN_CLOSE_WRITE = 8
  IN_CREATE = 256
  IN_DELETE = 512
  IN_DELETE_SELF = 1024
  IN_DONT_FOLLOW = 33554432
  IN_IGNORED = 32768
  IN_ISDIR = 1073741824
  IN_MASK_ADD = 536870912
  IN_MODIFY = 2
  IN_MOVE = 192
  IN_MOVED_FROM = 64
  IN_MOVED_TO = 128
  IN_MOVE_SELF = 2048
  IN_ONESHOT = -2147483648
  IN_ONLYDIR = 16777216
  IN_OPEN = 32
  IN_Q_OVERFLOW = 16384
  IN_UNMOUNT = 8192
  name = 'rm_watch'
Function Details [hide private]

get_events(fd, timeout=...)

source code 

Return a list of InotifyEvent instances representing events read from inotify. If timeout is None, this will block forever until at least one event can be read. Otherwise, timeout should be an integer or float specifying a timeout in seconds. If get_events times out waiting for events, an empty list will be returned. If timeout is zero, get_events will not block.


Variables Details [hide private]

constants

Value:
{'IN_ACCESS': 1,
 'IN_ALL_EVENTS': 4095,
 'IN_ATTRIB': 4,
 'IN_CLOSE': 24,
 'IN_CLOSE_NOWRITE': 16,
 'IN_CLOSE_WRITE': 8,
 'IN_CREATE': 256,
 'IN_DELETE': 512,
...