为什么Pyinotify不能观看导演?

Mat*_*ris 5 watch inotify pyinotify

我想Pyinotify看一个模板目录,它有子文件夹,但我收到这个错误:

DIRECTORY /home/project/templates
[Pyinotify ERROR] add_watch: cannot watch /home/project/templates WD=-1
[Pyinotify ERROR] add_watch: cannot watch /home/project/templates/dir1 WD=-1
[Pyinotify ERROR] add_watch: cannot watch /home/project/templates/dir2 WD=-1
Waiting for stuff to happen...
Run Code Online (Sandbox Code Playgroud)

我找到了诸如使用unicode目录名或使用其他使用inotify的程序的答案,但每个程序都过于具体.

什么一般导致这个错误?

Mat*_*ris 12

增加最大数量或观看:

sudo sysctl -n -w fs.inotify.max_user_watches=16384
Run Code Online (Sandbox Code Playgroud)

参考:http://github.com/seb-m/pyinotify/wiki/Frequently-Asked-Questions

在旁边

如果您正在寻找通知工具,请尝试http://github.com/peterbe/python-gorun.