Package entropy :: Module misc :: Class DirectoryMonitor

Class DirectoryMonitor

source code

DirectoryMonitor uses Linux dnotify facility to signal file change events for the monitored directory. However, this class attaches the event callback to SIGIO, thus it is not safe to have multiple instances of it around because there is no real event dispatching.

Instance Methods
 
__init__(self, directory_paths, callback, event_flags=None)
DirectoryMonitor constructor.
source code
 
close(self)
Terminate the listeners and release all the allocated resources.
source code
Class Variables
  DN_ACCESS = 1
  DN_MODIFY = 2
  DN_CREATE = 4
  DN_DELETE = 8
  DN_RENAME = 16
  DN_ATTRIB = 32
  DN_MULTISHOT = 2147483648
Method Details

__init__(self, directory_paths, callback, event_flags=None)
(Constructor)

source code 

DirectoryMonitor constructor.

Parameters:
  • directory_paths (list) - list of paths of the directories to monitor
  • callback (function) - function called on events. The signature is: void function()
  • event_flags (int) - specify an alternative flag mask, default is: DN_ACCESS | DN_MODIFY | DN_CREATE | DN_DELETE | DN_RENAME | DN_ATTRIB