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 tegavu
Recipients tegavu
Date 2014-10-27.18:04:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1414433052.69.0.696616373755.issue22744@psf.upfronthosting.co.za>
In-reply-to
Content
Windows does not like/permit folders with spaces in the beginning or folders and files with a tailing space character, as this will cause problems.
The python functions for os.mkdir will solve this by eliminating the blanks automatically.
But os.path.join() will give wrong results.

Example:

#Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23)
import os
dir1 = "c:\\"
dir2 = "test   "
file = "test.txt"     

os.mkdir( os.path.join(dir1, dir2) )    
    # this will correctly create c:\test\
f = open( os.path.join(dir1, dir2, file) ,"wb")
    # this will fail with 'FileNotFoundError: [Errno 2] No such file or directory: 'c:\\test     \\test.txt''
print("__" + os.path.join(dir1, dir2, file) + "__")   
    # this will incorrectly show 'c:\test     \test.txt'
    # or if you chose to also have spaces at the end of "test.txt     " will show them
History
Date User Action Args
2014-10-27 18:04:12tegavusetrecipients: + tegavu
2014-10-27 18:04:12tegavusetmessageid: <1414433052.69.0.696616373755.issue22744@psf.upfronthosting.co.za>
2014-10-27 18:04:12tegavulinkissue22744 messages
2014-10-27 18:04:12tegavucreate