Message230082
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 |
|
Date |
User |
Action |
Args |
2014-10-27 18:04:12 | tegavu | set | recipients:
+ tegavu |
2014-10-27 18:04:12 | tegavu | set | messageid: <1414433052.69.0.696616373755.issue22744@psf.upfronthosting.co.za> |
2014-10-27 18:04:12 | tegavu | link | issue22744 messages |
2014-10-27 18:04:12 | tegavu | create | |
|