From c6d738ef6d1aee3cd33869b863ee7a433ac1dcc1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 11 Dec 2020 13:40:52 +0530 Subject: [PATCH] Fix regression causing failure to start if one of the previously used libraries no longer exists. Fixes #1907773 [After Update 5.7 - Defect by Start](https://bugs.launchpad.net/calibre/+bug/1907773) --- src/calibre/srv/library_broker.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/calibre/srv/library_broker.py b/src/calibre/srv/library_broker.py index d83c176293..683a27b3c4 100644 --- a/src/calibre/srv/library_broker.py +++ b/src/calibre/srv/library_broker.py @@ -65,11 +65,14 @@ def library_id_from_path(path, existing=frozenset()): def correct_case_of_last_path_component(original_path): prefix, basename = os.path.split(original_path) q = basename.lower() - equals = tuple(x for x in os.listdir(prefix) if x.lower() == q) + try: + equals = tuple(x for x in os.listdir(prefix) if x.lower() == q) + except OSError: + equals = () if len(equals) > 1: if basename not in equals: basename = equals[0] - else: + elif equals: basename = equals[0] return os.path.join(prefix, basename)