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 Jeremy.Gray
Recipients Jeremy.Gray, brian.curtin, pitrou, tim.golden
Date 2013-06-15.21:00:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1371330039.96.0.0975919359902.issue18221@psf.upfronthosting.co.za>
In-reply-to
Content
Maybe this a documentation / run-time warning issue, rather than bug. Trailing spaces in filenames are illegal in Win32; nonetheless they can occur, because there are instructions on how to remove such files: http://support.microsoft.com/kb/320081. So os.path.abspath() not only returns the absolute path of a (hypothetical) file, it is also ensuring that the file name is legal within the operating system. It does so silently. (I say hypothetical because there's no requirement that the file actually exists.)

This behavior from python was surprising since "explicit is better than implicit": I was not getting just an absolute path, but a changed filename (causing a file-not-found error later in my code), with no warning from python at any point that the filename was illegal and so was being "cleaned up" for me, behind the scenes. Maybe this is the Windows-like way to do things (longtime mac / linux here).

Playing around a little, I see "open('file  ', 'wb')" also silently changes the filename.
History
Date User Action Args
2013-06-15 21:00:39Jeremy.Graysetrecipients: + Jeremy.Gray, pitrou, tim.golden, brian.curtin
2013-06-15 21:00:39Jeremy.Graysetmessageid: <1371330039.96.0.0975919359902.issue18221@psf.upfronthosting.co.za>
2013-06-15 21:00:39Jeremy.Graylinkissue18221 messages
2013-06-15 21:00:39Jeremy.Graycreate