Thanx Roger, With regards, -Shailesh
On 8/12/07, Roger Upole <[EMAIL PROTECTED]> wrote: > Shailesh Kumar wrote: > > Hi, > > > > Kindly have a look at following sample. > > > > I am trying to copy files from a folder to another folder using > > SHFileOperation. > > The folder name as well as file name contain characters from Hiragana > > script (Japanese). Neither Copy nor Move operations work. The > > operations work if the file path doesn't contain non-ascii characters. > > > > What am I doing wrong? > > > > I have PyWin32 - v 209. > > > > from win32com.shell import shell, shellcon > > > > > > def fileOperation(source, destination, operation): > > result = shell.SHFileOperation((0, operation, > > source, destination, > > shellcon.FOF_NOCONFIRMATION | > > shellcon.FOF_NOERRORUI | shellcon.FOF_SILENT)) > > if result == 0: > > raise Exception("Operation failed") > > return result > > > > def copyFile(source, destination): > > return fileOperation(source, destination, shellcon.FO_COPY) > > > > def moveFile(source, destination): > > return fileOperation(source, destination, shellcon.FO_MOVE) > > > > > > if __name__ == '__main__': > > "Lets do some testing of the above two functions" > > import os > > import sys > > testDir = ur"D:\\SHFOTestsDir" > > os.mkdir(testDir) > > "Some hiragana characters" > > smallA = u'\u3042' > > KA = u'\u304B' > > GI = u'\u304E' > > folder1Name = KA * 10 > > folder2Name = GI * 10 > > folder1Path = os.path.join(testDir, folder1Name) > > folder2Path = os.path.join(testDir, folder2Name) > > os.mkdir(folder1Path) > > os.mkdir(folder2Path) > > filenames = () > > contents = '20' * 100 > > for i in range(10): > > filename = KA * (i + 5) > > filepath = os.path.join(folder1Path, filename) > > f = open(filepath, 'w') > > f.write(contents) > > f.close() > > copyFile(filepath, folder2Path) > > > > With regards, > > - Shailesh > > This is another issue with compatibility with Windows 98, which doesn't > support the unicode version of this function directly. It's still possible to > wrap SHFileOperationW, but it takes some extra work. > > Python itself stops supporting Win98 as of 2.6, but Pywin32 will probably > continue supporting it for some time since Mark usually creates releases > for at least 2 prior versions of Python. > > Roger > > _______________________________________________ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32