Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

S3cmd error report

Ken
2011-10-11
2013-03-14
  • Ken
    Ken
    2011-10-11

    Hi all

    I have a script which copies backups from my server to S3, it looks like this

    s3cmd sync  –recursive  –delete-removed  /backup  s3://myserver/backup/

    It works fine when run from the command line, but when run overnight as a cron job I get the following error:

    Problem: UnicodeEncodeErr: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)
    S3cmd:   1.0.0

    Traceback (most recent call last):
    File "/usr/bin/s3cmd", line 2006, in ?
       main()
    File "/usr/bin/s3cmd", line 1950, in main
       cmd_func(args)
    File "/usr/bin/s3cmd", line 1211, in cmd_sync
       return cmd_sync_local2remote(args)
    File "/usr/bin/s3cmd", line 1111, in cmd_sync_local2remote
       local_list, single_file_local = fetch_local_list(args, recursive = True)
    File "/usr/bin/s3cmd", line 240, in fetch_local_list
       if uri.isdir() and not recursive:
    File "/usr/lib/python2.4/site-packages/S3/S3Uri.py", line 154, in isdir
       return os.path.isdir(self.path())
    File "/usr/lib/python2.4/posixpath.py", line 195, in isdir
       st = os.stat(path)
    UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)

    I'm a little out of my depth here and any help or advice would be much appreciated.

    Ken

     
  • same here!

     
  • For me too:

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        An unexpected error has occurred.
      Please report the following lines to:
       s3tools-bugs@lists.sourceforge.net
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Problem: UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)
    S3cmd:   1.0.0
    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 335, in cmd_object_put
        local_list, single_file_local = fetch_local_list(args)
      File "/usr/bin/s3cmd", line 240, in fetch_local_list
        if uri.isdir() and not recursive:
      File "/usr/share/s3cmd/S3/S3Uri.py", line 154, in isdir
        return os.path.isdir(self.path())
      File "/usr/lib/python2.6/genericpath.py", line 41, in isdir
        st = os.stat(s)
    UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        An unexpected error has occurred.
        Please report the above lines to:
       s3tools-bugs@lists.sourceforge.net
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    
     
  • Atte
    Atte
    2013-03-14

    Hi,

    This is already pretty old topic, but didn't find newer when tried to solve problem with my script. This is actually not a s3cmd problem, instead it results from differences of system variables used when running script from crontab instead of running from command line.

    To solve this problem, export locale in your script before starting s3cmd. E.g. add "export LANG=en_US.UTF-8" to beginning of script.

    -Atte