本篇內(nèi)容主要講解“S3cmd signurl中文支持問(wèn)題怎么解決”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來(lái)帶大家學(xué)習(xí)“S3cmd signurl中文支持問(wèn)題怎么解決”吧!
創(chuàng)新互聯(lián)是一家專(zhuān)業(yè)提供浦北企業(yè)網(wǎng)站建設(shè),專(zhuān)注與成都做網(wǎng)站、成都網(wǎng)站制作、成都外貿(mào)網(wǎng)站建設(shè)、H5開(kāi)發(fā)、小程序制作等業(yè)務(wù)。10年已為浦北眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專(zhuān)業(yè)網(wǎng)絡(luò)公司優(yōu)惠進(jìn)行中。
s3cmd --version s3cmd version 1.6.1 s3cmd signurl s3://s3demo/ceph知識(shí)樹(shù).png +200 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! An unexpected error has occurred. Please try reproducing the error using the latest s3cmd code from the git master branch found at: https://github.com/s3tools/s3cmd and have a look at the known issues list: https://github.com/s3tools/s3cmd/wiki/Common-known-issues-and-their-solutions If the error persists, please report the following lines (removing any private info as necessary) to: s3tools-bugs@lists.sourceforge.net You have encountered a UnicodeEncodeError. Your environment variable LANG=zh_CN.UTF-8 may not specify a Unicode encoding (e.g. UTF-8). Please set LANG=en_US.UTF-8 or similar in your environment before invoking s3cmd. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Invoked as: /usr/local/bin/s3cmd signurl s3://hxs1-s3soft/ceph知識(shí)樹(shù).png +200 Problem: UnicodeEncodeError: 'ascii' codec can't encode characters in position 31-33: ordinal not in range(128) S3cmd: 1.6.1 python: 2.7.10 (default, Oct 23 2015, 19:19:21) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] environment LANG=zh_CN.UTF-8 Traceback (most recent call last): File "/usr/local/bin/s3cmd", line 2923, inrc = main() File "/usr/local/bin/s3cmd", line 2843, in main rc = cmd_func(args) File "/usr/local/bin/s3cmd", line 2017, in cmd_signurl debug("url to sign: %r" % url_to_sign) UnicodeEncodeError: 'ascii' codec can't encode characters in position 31-33: ordinal not in range(128) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! An unexpected error has occurred. Please try reproducing the error using the latest s3cmd code from the git master branch found at: https://github.com/s3tools/s3cmd and have a look at the known issues list: https://github.com/s3tools/s3cmd/wiki/Common-known-issues-and-their-solutions If the error persists, please report the above lines (removing any private info as necessary) to: s3tools-bugs@lists.sourceforge.net !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
在s3cmd源碼文件中添加下面兩行解決
reload(sys) sys.setdefaultencoding('utf-8')
patch最終效果
2894 if __name__ == '__main__': 2895 try: 2896 ## Our modules 2897 ## Keep them in try/except block to 2898 ## detect any syntax errors in there 2899 reload(sys) #新加 2900 sys.setdefaultencoding('utf-8') #新加 2901 from S3.ExitCodes import * 2902 from S3.Exceptions import *
到此,相信大家對(duì)“S3cmd signurl中文支持問(wèn)題怎么解決”有了更深的了解,不妨來(lái)實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢(xún),關(guān)注我們,繼續(xù)學(xué)習(xí)!