From b7e6b8fbee6494e3304cfee103ed2ff9d4408458 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 30 Oct 2020 21:22:40 +0530 Subject: [PATCH] Windows: Fix regression causing error when choosing save file names Fixes #1902247 [Error when exporting files from Edit book](https://bugs.launchpad.net/calibre/+bug/1902247) --- src/calibre/gui2/win_file_dialogs.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/win_file_dialogs.py b/src/calibre/gui2/win_file_dialogs.py index 3c4679dba0..45b18f3cd2 100644 --- a/src/calibre/gui2/win_file_dialogs.py +++ b/src/calibre/gui2/win_file_dialogs.py @@ -227,7 +227,11 @@ def run_file_dialog( def fix_path(x): u = os.path.abspath(x.decode('utf-8')) - return get_long_path_name(u) + try: + return get_long_path_name(u) + except FileNotFoundError: + base, fn = os.path.split(u) + return os.path.join(get_long_path_name(base), fn) ans = tuple(map(fix_path, parts[1:])) return ans