mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Ignore any errors from calling get_long_path_name
Fixes #1902257 [failed import on newest release](https://bugs.launchpad.net/calibre/+bug/1902257)
This commit is contained in:
parent
9be75ea01d
commit
02edfdfa86
@ -9,6 +9,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
from contextlib import suppress
|
||||||
|
|
||||||
|
|
||||||
from polyglot.builtins import filter, string_or_bytes, unicode_type
|
from polyglot.builtins import filter, string_or_bytes, unicode_type
|
||||||
@ -227,11 +228,13 @@ def run_file_dialog(
|
|||||||
|
|
||||||
def fix_path(x):
|
def fix_path(x):
|
||||||
u = os.path.abspath(x.decode('utf-8'))
|
u = os.path.abspath(x.decode('utf-8'))
|
||||||
|
with suppress(Exception):
|
||||||
try:
|
try:
|
||||||
return get_long_path_name(u)
|
return get_long_path_name(u)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
base, fn = os.path.split(u)
|
base, fn = os.path.split(u)
|
||||||
return os.path.join(get_long_path_name(base), fn)
|
return os.path.join(get_long_path_name(base), fn)
|
||||||
|
return u
|
||||||
|
|
||||||
ans = tuple(map(fix_path, parts[1:]))
|
ans = tuple(map(fix_path, parts[1:]))
|
||||||
return ans
|
return ans
|
||||||
|
Loading…
x
Reference in New Issue
Block a user