-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyError in __handle_inotify_event #1
Comments
I'll have to take a look a it later today. This is a dictionary of all On Sat, Jun 13, 2015 at 5:25 AM, backbord notifications@github.com wrote:
|
At closer inspection, the error pops up regularly after my cleanup process removed old files and empty subdirectories from the watched directory find $HOME/mirror -mmin +2880 -type f -exec rm -f {} \;
find $HOME/mirror -depth -type d -empty -exec rmdir {} \; Could it be the case that the IN_DELETE events for files and directories which inotify creates are out of order (or read out of order by PyInotify) so that the watch for a subdir is removed (with Please let me know if I can help to find the cause. :-) |
Hm, the watched From the traceback in my first post and the following one, I identified two places where removed watches appear to cause problems.
I'll let my program run with this patch to PyInotify and will get back to you if I see anything interesting. --- inotify/adapters.py
+++ inotify/adapters.py
@@ -65,7 +65,9 @@
our tracking since inotify already cleans-up the watch.
"""
- wd = self.__watches[path]
+ wd = self.__watches.get(path)
+ if wd is None:
+ return
del self.__watches[path]
del self.__watches_r[wd]
@@ -131,7 +133,9 @@
self.__buffer = self.__buffer[event_length:]
- path = self.__watches_r[header.wd]
+ path = self.__watches_r.get(header.wd)
+ if path is None:
+ break
yield (header, type_names, path, filename)
buffer_length = len(self.__buffer) Again, thanks for putting together such a nice straightforward code! Best regards, |
Hmm. I prefer very strict code. However, as you mentioned before, things
|
Hi Dustin, Best regards, |
I think your way is already the best way for IDs that aren't going to be Dustin
|
If this seems to work, please submit a PR. Dustin On Tue, Jun 16, 2015 at 4:06 AM, Dustin Oprea myselfasunder@gmail.com
|
Ok, my first pull request ever. Hope it's to your liking. :-) Thanks and regards, |
I've performed a release of 0.2.4. This includes the fix. |
Hi, I've recently started to use your nice little project in version 0.2.3 (I used pyinotify before).
However, I stumbled across the following error and hope that you can help me.
The number varies. I've seen all from 9 to 10 and from 220 to 229.
Have you seen this error before and can advice?
The function
handle_events(path)
is intended to announce all files under a path whenever they are closed after writing. It is defined as follows.Best regards,
Tim
The text was updated successfully, but these errors were encountered: