Eryk Sun <eryk...@gmail.com> added the comment:

Builtin open() calls C open(). This C function supports whatever path types are 
supported natively. In Windows, C open() calls WinAPI CreateFileW(), which does 
not support "file://" URIs. The Windows API handles it as a relative path, 
which gets resolved against the current working directory. For example:

    >>> os.getcwd()
    'C:\\Temp'
    >>> nt._getfullpathname('file:////host/share/file')
    'C:\\Temp\\file:\\host\\share\\file'
    >>> nt._getfullpathname('file://host/share/file')
    'C:\\Temp\\file:\\host\\share\\file'

As to the resolved path somehow working, that generally will not be the case. 
Most filesystems in Windows will reject a path component named "file:" as an 
invalid name. The ":" character is usually disallowed in base file and 
directory names, since some Windows filesystems use it as a delimiter in file 
streams, e.g. "name:stream_name:stream_type". The default data stream in a 
regular file has no stream name, and its stream type is "$DATA". Thus for base 
name "file", the default data stream can be referenced explicitly as 
"file::$DATA". But just "file:", with neither a stream name nor a stream type, 
is an invalid name.

----------
nosy: +eryksun

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46654>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to