dsoprea / PyInotify

An efficient and elegant inotify (Linux filesystem activity monitor) library for Python. Python 2 and 3 compatible.
GNU General Public License v2.0
242 stars 73 forks source link

InotifyTree doesn't work on re-created directory #77

Open AiRyunn opened 4 years ago

AiRyunn commented 4 years ago

I'm using InotifyTree, but when I recreate a directory, it outputs "Path already being watched: /my/folder", and ignore all events about this folder.

dkrystki commented 4 years ago

I'm having the same problem.

PlasmaHH commented 3 years ago

It seems this issue is caused by the module not listening to IN_DELETE_SELF events. In theory it would work to just register yourself for that event and call remove_watch on the Inotify object, however since the superficial parameter is not passed on from remove_watch to remove_watch_with_id this would result in an invalid system call. Since this is the last statement in that function calling remove_watch and catching that exception works as a workaround for me....

dheeg commented 1 year ago

This is already fixed in the master branch but not the current pip package.

pip install git+https://github.com/dsoprea/PyInotify