This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author laloch
Recipients eryksun, gaborjbernat, laloch, paul.moore, steve.dower, tim.golden, zach.ware
Date 2020-04-10.13:18:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586524708.7.0.997628891426.issue40238@roundup.psfhosted.org>
In-reply-to
Content
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'
History
Date User Action Args
2020-04-10 13:18:28lalochsetrecipients: + laloch, paul.moore, tim.golden, zach.ware, eryksun, steve.dower, gaborjbernat
2020-04-10 13:18:28lalochsetmessageid: <1586524708.7.0.997628891426.issue40238@roundup.psfhosted.org>
2020-04-10 13:18:28lalochlinkissue40238 messages
2020-04-10 13:18:28lalochcreate