This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Adam.Matan
Recipients Adam.Matan
Date 2011-04-02.14:25:53
SpamBayes Score 5.109619e-07
Marked as misclassified No
Message-id <1301754354.21.0.769652184716.issue11741@psf.upfronthosting.co.za>
In-reply-to
Content
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 more information.
>>> import glob
>>> import shutil
>>> files=glob.glob('*.ods')
>>> for file in files:
...     shutil.copy2(file, 'א') # This works, but:
...
>>> for file in files:
...     shutil.copy2(file, u'א')
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/usr/lib/python2.6/shutil.py", line 98, in copy2
    dst = os.path.join(dst, os.path.basename(src))
  File "/usr/lib/python2.6/posixpath.py", line 70, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 1: ordinal not in range(128)


See discussion here: http://stackoverflow.com/questions/5523373/python-how-to-move-a-file-with-unicode-filename-to-a-unicode-folder/5523385#5523385
History
Date User Action Args
2011-04-02 14:25:54Adam.Matansetrecipients: + Adam.Matan
2011-04-02 14:25:54Adam.Matansetmessageid: <1301754354.21.0.769652184716.issue11741@psf.upfronthosting.co.za>
2011-04-02 14:25:53Adam.Matanlinkissue11741 messages
2011-04-02 14:25:53Adam.Matancreate