Skip to content

Commit

Permalink
Fix opening local files on windows in python 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurie committed Jan 8, 2023
1 parent dafac12 commit cdc8f3c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion deepzoom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())


Expand Down

0 comments on commit cdc8f3c

Please sign in to comment.