From: Garrick T. <gto...@ya...> - 2010-01-02 22:52:34
|
I encountered problems attempting to upload files with unicode characters in the names, and tracked it down to calls to str() on the destination uri. I changed that to uri.uri() in three places, effectively and it seemed to fix it. Before and after examples below, as well as the diff. I would very much appreciate feedback on whether this is a correct fix and if there is a more productive way to submit. thanks! gt $ /usr/local/encap/s3cmd-0.9.9.91/bin/s3cmd put --acl-public --force "/var/www/files/ons1/169/1699280/09_2009/NARS Hervé Léger Face Chart.jpg" "s3://extimg.popsugar.com/files/ons1/169/1699280/09_2009/NARS Hervé Léger Face Chart.jpg" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! An unexpected error has occurred. Please report the following lines to: s3t...@li... !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Problem: UnicodeEncodeErr: 'ascii' codec can't encode character u'\xe9' in position 65: ordinal not in range(128) S3cmd: 0.9.9.91 Traceback (most recent call last): File "/usr/local/encap/s3cmd-0.9.9.91/bin/s3cmd", line 1736, in ? main() File "/usr/local/encap/s3cmd-0.9.9.91/bin/s3cmd", line 1681, in main cmd_func(args) File "/usr/local/encap/s3cmd-0.9.9.91/bin/s3cmd", line 294, in cmd_object_put destination_base = str(destination_base_uri) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 65: ordinal not in range(128) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! An unexpected error has occurred. Please report the above lines to: s3t...@li... !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $ /usr/local/encap/s3cmd-0.9.9.91/bin/s3cmd-patched put --acl-public --force "/var/www/files/ons1/169/1699280/09_2009/NARS Hervé Léger Face Chart.jpg" "s3://extimg.popsugar.com/files/ons1/169/1699280/09_2009/NARS Hervé Léger Face Chart.jpg"" /var/www/files/ons1/169/1699280/09_2009/NARS Hervé Léger Face Chart.jpg -> s3://extimg.popsugar.com/files/ons1/169/1699280/09_2009/NARS Hervé Léger Face Chart.jpg [1 of 1] 411771 of 411771 100% in 1s 326.93 kB/s done Public URL of the object is: http://extimg.popsugar.com.s3.amazonaws.com/files/ons1/169/1699280/09_2009/NARS Hervé Léger Face Chart.jpg [areitz@sugar-ops-nms01-lax1 S3]$ cd /tmp $ diff /usr/local/bin/s3cmd /usr/local/bin/s3cmd.patched 245c245 < uri_str = str(uri) --- > uri_str = uri.uri(); 294c294 < destination_base = str(destination_base_uri) --- > destination_base = destination_base_uri.uri(); 966c966 < destination_base = str(destination_base_uri) --- > destination_base = destination_base_uri.uri(); |