From 4e969cacf32d150244167c4ee77a253e3bdbc370 Mon Sep 17 00:00:00 2001 From: Laurie Date: Sun, 8 Jan 2023 17:23:56 +0000 Subject: [PATCH] Fix opening local files on windows in python 3.x --- deepzoom/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepzoom/__init__.py b/deepzoom/__init__.py index 6747433..3d4872c 100755 --- a/deepzoom/__init__.py +++ b/deepzoom/__init__.py @@ -544,7 +544,7 @@ def safe_open(path): # not a URL. This change is isolated to this function as we want the output # XML to still have the original input paths instead of absolute paths: has_scheme = bool(urlparse(path).scheme) - normalized_path = ("file://%s" % os.path.abspath(path)) if not has_scheme else path + normalized_path = ("file:%s" % urllib.request.pathname2url(os.path.abspath(path))) if not has_scheme else path return io.BytesIO(urllib.request.urlopen(normalized_path).read())