【问题标题】:Why isn't Pyinotify able to watch a dir?为什么 Pyinotify 不能观看目录?
【发布时间】:2011-04-19 03:25:10
【问题描述】:

我希望 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...

我找到了答案,例如使用 unicode 目录名称或使用其他使用 inotify 的程序,但每个都太具体了。

通常是什么原因导致此错误?

【问题讨论】:

标签: watch inotify pyinotify


【解决方案1】:

增加观看次数上限:

sudo sysctl -n -w fs.inotify.max_user_watches=16384

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

旁白

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-09
    • 2017-09-20
    • 1970-01-01
    • 1970-01-01
    • 2011-02-18
    • 2011-07-13
    • 2015-01-25
    • 2015-05-02
    相关资源
    最近更新 更多