pyneric.fsnotify¶
The pyneric.fsnotify
module contains file system notification helpers.
Use of this module requires the pyinotify library.
-
class
pyneric.fsnotify.
FileSystemNotifier
(queue)[source]¶ Bases:
object
Notify the caller of file system changes via a queue using pyinotify.
Events from the pyinotify library are put onto the queue according to the watches the caller configures in
watch_manager
. The notifier needs to be started viastart()
to get the events. The notifier needs to be stopped viastop()
when the caller would like to stop the events or delete the notifier.Note that the inotify polling occurs in a separate thread, and one such thread is created for each
FileSystemNotifier
instance, so if it is feasible, sharing a notifier/queue is recommended for multiple watches.-
notifier
¶ A pyinotify.ThreadedNotifier instance that is a Python
Thread
that watches the file system for events configured inwatch_manager
. Those events are put on thequeue
as they occur.
-
queue
¶ A Python
queue.Queue
instance (orQueue.Queue
in Python 2) that is provided to the constructor.
-
watch_manager
¶ A pyinotify.WatchManager instance that provides management for which events to watch on which files and directories.
-
start
()¶
-
stop
()¶
All other methods are passed through to
watch_manager
. See pyinotify.WatchManager.-