[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Adam Matan
New submission from Adam Matan a...@matan.name: shutil.copy2(file, dest) fails when dest has unicode characters: [2011-04-02 17:19:54 adam@adam-laptop ~/personal :) ]$ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3] on linux2 Type help, copyright, credits or license for

[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- components: +Library (Lib) -Extension Modules nosy: +ezio.melotti stage: - test needed type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11741

[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: The problem here is that you are mixing byte strings and unicode. glob.glob('*.ods') returns a list of strings, so in shutil.copy2(file, 'א') you are passing two byte strings and everything works fine. In shutil.copy2(file, u'א') instead,

[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Adam Matan
Adam Matan a...@matan.name added the comment: Don't you think that shutil should be able to handle mixed data types, for example byte string as file name and unicode destination directory? This is, in my opinion, a very common scenario. Would you consider converting all arguments to Unicode?

[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: I should have added that both 'א' and u'א' work as long as the file names in the list returned by glob() are ASCII: if u'א' is used they are simply coerced to unicode. If there are non-ASCII file names in the glob() list, the copy fails

[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Adam Matan
Adam Matan a...@matan.name added the comment: Don't you think it should be changed in Python 2.x, so that the ASCII filename will be automatically converted to to Unicode? -- ___ Python tracker rep...@bugs.python.org

[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: The ASCII filename is already converted to unicode, but in your case the program was most likely failing with some non-ASCII filename. -- ___ Python tracker rep...@bugs.python.org

[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Adam Matan
Adam Matan a...@matan.name added the comment: Do you think it should be fixed at the module level? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11741 ___

[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: Mixing byte and unicode strings should always be avoided, because the implicit coercion to unicode works only if the byte strings contains only ASCII, and fails otherwise. Several modules -- including shutil, glob, and os.path -- have API