Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 308
Matt Norris Avatar asked Sep 30 '10 02:09

Matt Norris


1 Answers

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.

like image 199
Matt Norris Avatar answered Oct 10 '22 15:10

Matt Norris