Mike Auty <[email protected]> added the comment:
I can confirm that url2pathname work with either number of slashes, and that
open_file appears to have had the file: removed.
However, in even if the check in open_file were bypassed, it calls
open_local_file, which then strips any host before calling url2pathname,
meaning the host will never be included if only two slashes are used.
host, file = _splithost(url)
localname = url2pathname(file)
This is what seems to cause the issue when attempting to open
file://server/host/file.ext on windows, even though
file:////server/host/file.ext open just fine.
The problem that I found, and was in bug #32442, is that pathlib only ever
returns two slashes, which despite being a valid and correctly formed url,
can't be opened by urllib.request.urlopen(). Since there doesn't seem to be an
issue with opening these files (given it works for file:////server...) and
since nt2pathname will produce the correct result, it feels as though open_file
should have special code on windows to allow servers to be accepted by the file
handler (open_local_file should probably stay as is to not change the API too
much).
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46654>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com