/usr/share/doc/python-pyinotify-doc/examples/not_quiet.py is in python-pyinotify-doc 0.9.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # Example: raise exceptions on errors.
#
# Overrides default behavior and raise exception on add_watch, update_watch
# or rm_watch errors.
import pyinotify
wm = pyinotify.WatchManager()
# default behavior, don't complain but keep trace of error in log and result
r = wm.add_watch(['/tmp', '/tmp-do-not-exist'], pyinotify.ALL_EVENTS)
print r
# quiet=False raise exception
try:
wm.add_watch(['/tmp', '/tmp-do-not-exist'],
pyinotify.ALL_EVENTS, quiet=False)
except pyinotify.WatchManagerError, err:
print err, err.wmd
# quiet=False raise exception
try:
wm.update_watch(42, mask=0x42, quiet=False)
except pyinotify.WatchManagerError, err:
print err, err.wmd
# quiet=False raise exception
try:
wm.rm_watch(42, quiet=False)
except pyinotify.WatchManagerError, err:
print err, err.wmd
|