From 7baa51e585d73c13648e246e07f87bb0365ddc6c Mon Sep 17 00:00:00 2001 From: Alexander Schmidt Date: Mon, 19 Oct 2020 14:25:04 +0200 Subject: [PATCH] ignore deletion events --- src/dirtrigger.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dirtrigger.py b/src/dirtrigger.py index 7978df3..2ea981c 100644 --- a/src/dirtrigger.py +++ b/src/dirtrigger.py @@ -1,6 +1,6 @@ import threading import time -from watchdog.events import FileSystemEventHandler +from watchdog.events import DirDeletedEvent, FileDeletedEvent, FileSystemEventHandler from watchdog.observers import Observer class DirTrigger(FileSystemEventHandler): @@ -35,6 +35,9 @@ class DirTrigger(FileSystemEventHandler): self._last_reset_time = time.time() def on_any_event(self, event): + if event.event_type == FileDeletedEvent or event.event_type == DirDeletedEvent: + return + self._lock.acquire() try: self._got_event = True -- 2.39.5