i'm on windows, using active python 2.7.1
i've written a script to copy a folder of files to dest folder..
one if the files in this folder has the section symbol (?, '\x15') as
part of the file name
shutil.copy(src_file, dst_file) "can't find the file specified" when
it does the os.chmod() part, can't find dest file,
cuz the file got copied with "_" in place of the section symbol.
Traceback (most recent call last):
File "../../python/post_build.py", line 159, in <module>
File "../../python/post_build.py", line 105, in main
paths.copy_folder(srcResFolder + 'Export', destRes + '/codecs/
\paths.py", line 77, in copy_folder
\paths.py", line 80, in copy_folder
\paths.py", line 37, in copy_file
File "C:\Python27\lib\shutil.py", line 117, in copy
File "C:\Python27\lib\shutil.py", line 90, in copymode
WindowsError: [Error 2] The system cannot find the file specified:
'build\\kJams Pro Debug.app/Contents/Resources/codecs/Export/Codec
[MooV]/Animation \xa7 AAC.rtm'
if i replace that with shutil.copyfile(src_file, dst_file) it "works",
again by replacing the section symbol with underbar.
but that leaves me to call os.chmod() myself, which of course fails
because of the character substitution.
i'm gathering the list of files to iterate over the folder via:
fileList = os.listdir(src_dir)
for fileName in fileList:
and yes, src_dir is "unicode". but the fileName when i print it shows
the degree symbol (?, '\xa7') in place of the section symbol.
i suspect it's a 'dbcs' or 'latin_1' problem?
this same exact python code works on the mac (it's utf8 down to the
metal) and, get this, it works when running Windows under Parallels
Desktop. It fails only when running Windows natively. I can't see
how that makes a difference.
i can give a whole lot more info, but i just want to know if i'm
trying to do something impossible. If this seems strange to y'all
gladly i'll fill in all the details, but hoping it can be short
circuited by someone going "ah hah! you have to do such and so".