orenoblog

エンジニアになりたいExcel方眼紙erの物語

s3cmd実行時のエラー

EPELリポジトリからインストールしたs3cmd 1.0.1を利用し、
S3からファイルを同期しようとした時に発生したエラー

$ time s3cmd sync --bucket-location=ap-northeast-1 s3://bucket/ /tmp/sync
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    An unexpected error has occurred.
  Please report the following lines to:
   s3tools-bugs@lists.sourceforge.net
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Problem: UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 9: ordinal not in range(128)
S3cmd:   1.0.1

Traceback (most recent call last):
  File "/usr/bin/s3cmd", line 2006, in <module>
    main()
  File "/usr/bin/s3cmd", line 1950, in main
    cmd_func(args)
  File "/usr/bin/s3cmd", line 1213, in cmd_sync
    return cmd_sync_remote2local(args)
  File "/usr/bin/s3cmd", line 1027, in cmd_sync_remote2local
    warning(u"%s is a directory - skipping over" % dst_file)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 9: ordinal not in range(128)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    An unexpected error has occurred.
    Please report the above lines to:
   s3tools-bugs@lists.sourceforge.net
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

UnicodeDecodeErrorからするとバケット内にマルチバイトのファイルが存在した模様。

sitecustomize.pyにsys.setdefaultencoding('utf-8')を記述する。