David Strobach <laloc...@gmail.com> added the comment:

Hi Eryk, thanks for your time and for the explanation.

> The Windows file API normalizes paths to replace forward slashes with 
> backslashes; resolve relative paths and "." and ".." components; strip 
> trailing spaces and dots from the final component; and map reserved DOS 
> device names in the final component of non-UNC paths to device paths (e.g. 
> "C:/Temp/con " -> r"\\.\con").

OK, I understand. I know that Win32 documentation suggests to avoid using paths 
with trailing spaces and that the paths are subject to normalization. Then I'd 
say os.path.normpath() should  perform the same (GetFullPathNameW?) 
normalization as os.stat() and friends do.

Currently:

>>> import os
>>> path = r"c:\Program Files "
>>> os.path.normpath(path)
'c:\\Program Files '
>>> os.path.realpath(path)
'C:\\Program Files'

----------

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

Reply via email to