root / not_quiet.py

Revision ca5ddc5f5eea62c76b6be75a1fbdedf663dbcfd0, 0.8 kB (checked in by Sebastien Martini <ookoi@…>, 5 months ago)

Flag example files as 'Example'.

  • Property mode set to 100644
Line 
1# Example
2#
3
4# Overrides default behavior and raise exception on add_watch, update_watch,
5# rm_watch errors.
6
7import pyinotify
8
9wm = pyinotify.WatchManager()
10
11
12# default behavior, don't complain but keep trace of error in log and result
13r = wm.add_watch(['/tmp', '/tmp-do-not-exist'], pyinotify.ALL_EVENTS)
14print r
15
16
17# quiet=False raise exception
18try:
19    wm.add_watch(['/tmp', '/tmp-do-not-exist'], 
20                     pyinotify.ALL_EVENTS, quiet=False)
21except pyinotify.WatchManagerError, err:
22    print err, err.wmd
23
24
25# quiet=False raise exception
26try:
27    wm.update_watch(42, mask=0x42, quiet=False)
28except pyinotify.WatchManagerError, err:
29    print err, err.wmd
30
31
32# quiet=False raise exception
33try:
34    wm.rm_watch(42, quiet=False)
35except pyinotify.WatchManagerError, err:
36    print err, err.wmd
Note: See TracBrowser for help on using the browser.