From d5ce6d31c564108fc1b02c40b01a6208bf803059 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Sat, 18 Jul 2020 18:15:01 +0100 Subject: [PATCH] Handle FileNotFoundError I'm guessing watchdog's behaviour changed in an update, as the error thrown when the watched directory doesn't exist is now "FileNotFoundError" instead of "NotADirectoryError". It'll handle either one now. --- jellyfin_accounts/pw_reset.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jellyfin_accounts/pw_reset.py b/jellyfin_accounts/pw_reset.py index 06b7fe1..d998f25 100755 --- a/jellyfin_accounts/pw_reset.py +++ b/jellyfin_accounts/pw_reset.py @@ -19,7 +19,8 @@ class Watcher: self.observer.schedule(event_handler, self.dir, recursive=True) try: self.observer.start() - except NotADirectoryError: + except (NotADirectoryError, + FileNotFoundError): log.error(f"Directory {self.dir} does not exist") try: while True: