From 6a0b6f46de76111ab8f58e1a9c80245920db6ac6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 24 Apr 2023 22:25:47 +0530 Subject: [PATCH] Ignore files for which stat() fails when listing extra files --- src/calibre/db/backend.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/db/backend.py b/src/calibre/db/backend.py index 3f9692c0e8..c292c0b937 100644 --- a/src/calibre/db/backend.py +++ b/src/calibre/db/backend.py @@ -1915,7 +1915,10 @@ class DB: relpath = os.path.relpath(path, full_book_path) relpath = relpath.replace(os.sep, '/') if relpath not in known_files: - stat_result = os.stat(path) + try: + stat_result = os.stat(path) + except OSError: + continue if stat.S_ISDIR(stat_result.st_mode): continue if yield_paths: