Closed renatosamperio closed 5 years ago
This is an debian/ubuntu "issue". You can fix it adding this line in /etc/sysctl.conf file. fs.inotify.max_user_watches=524288
It's about the max number of user that can watch. It show when you try to watch a huge number of files/directory.
This maybe a seperate issue but....
I've just hit this problem; and got the following message.
inotify.calls.InotifyError: Call failed (should not be -1): (-1) ERRNO=(0)
And was confused, and slowed in my debugging by the zero errno. I changed the sysctl variable as above; and it works; but I still see a zero errno if I try something that shouldn't work. Is there something else going on here? ( I would have expected something like ENOSPC and EACCESS respectively, or at least their numeric equivalents)
Python 3.7.2rc1 (default, Dec 12 2018, 06:25:49)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import inotify.adapters
>>> i = inotify.adapters.Inotify()
>>> i.add_watch("./testdir")
1
>>> i.add_watch("/root" )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "~/.local/share/virtualenvs/test/lib/python3.7/site-packages/inotify/adapters.py", line 95, in add_watch
wd = inotify.calls.inotify_add_watch(self.__inotify_fd, path_bytes, mask)
File "~/.local/share/virtualenvs/test/lib/python3.7/site-packages/inotify/calls.py", line 36, in _check_nonnegative
(result,))
inotify.calls.InotifyError: Call failed (should not be -1): (-1) ERRNO=(0)
I'm not really sure where we can go with this discussion. Doesn't seem like an issue with the project. As much as I'd like to help, I don't think I/we can.
If you make any progress, feel free to post a pull request with a modification to the README.md to share it with others.
@alphadx That includes you. You're welcome to add a "Troubleshooting" section with this as the first item.
echo fs.inotify.max_user_watches=16384 | sudo tee -a /etc/sysctl.conf sudo sysctl -p
it's work please check it
I made a simple program to monitor my home path:
I am getting the following error:
I had to run the program with SUDO though. But whenver I remove the following exception, all works fine:
Why was this check required? Is it good idea to remove it?
Regards,
Renato.