Matt Norris
Matt Norris

Reputation: 8836

Why isn't Pyinotify able to watch a dir?

I would like Pyinotify to watch a templates directory, which has subfolders, but I'm getting this error:

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...

I've found answers such as using a unicode directory name or using other programs which use inotify, but each is too specific.

What generally causes this error?

Upvotes: 7

Views: 6518

Answers (1)

Matt Norris
Matt Norris

Reputation: 8836

Increase the maximum number or watches:

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

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

ASIDE

If you're looking for notification tools, also try http://github.com/peterbe/python-gorun.

Upvotes: 14

Related Questions