From 37349f1e56ddc011d8072c7f3ab14eed3b7c4a62 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 31 Aug 2015 08:24:34 +0530 Subject: [PATCH] When deleting a folder in the library and the folder has already been deleted do not fail --- src/calibre/db/backend.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/db/backend.py b/src/calibre/db/backend.py index 47e4c90c76..0cd0833c69 100644 --- a/src/calibre/db/backend.py +++ b/src/calibre/db/backend.py @@ -1111,7 +1111,9 @@ class DB(object): if self.is_deletable(path): try: shutil.rmtree(path) - except: + except EnvironmentError as e: + if e.errno == errno.ENOENT and not os.path.exists(path): + return import traceback traceback.print_exc() time.sleep(1) # In case something has temporarily locked a file