[issue11741] shutil2.copy fails with destination filenames

Ezio Melotti report at bugs.python.org
Sat Apr 2 16:54:15 CEST 2011


Ezio Melotti <ezio.melotti at 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, file is a byte string, and u'א' is unicode, so the copy fails.
If you want to use u'א', you can pass u'*.ods' to glob.glob() in order to get a list of unicode strings from there too.

----------
resolution:  -> invalid
stage: test needed -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11741>
_______________________________________


More information about the Python-bugs-list mailing list