gsutil无法使用“编解码器无法解码字节"上传文件,错误 [英] gsutil fails to upload file with "codec can't decode byte" error
问题描述
我正在使用命令将静态网站上传到云存储
I'm uploading a static website to cloud storage using the command
gsutil cp -v -R -c * gs://www.gennadiy-dolzhenko.ru
过程中,它失败,并显示以下输出
mid process it fails with the following output
...SNIP...
Copying file://tourism_studies/models/articles/54-moskva/slideshow/resized/sk576.jpg [Content-Type=image/jpeg]...
Created: gs://www.gennadiy-dolzhenko.ru/tourism_studies/models/articles/54-moskva/slideshow/resized/sk576.jpg#1403352412336000
Copying file://tourism_studies/models/articles/54-moskva/slideshow/resized/7.jpg [Content-Type=image/jpeg]...
Created: gs://www.gennadiy-dolzhenko.ru/tourism_studies/models/articles/54-moskva/slideshow/resized/7.jpg#1403352412725000
'ascii' codec can't decode byte 0xdd in position 1: ordinal not in range(128)
不清楚哪个文件有错误,并且 -c
标志不会使该工具继续按照所述进行上载.如何确定导致错误的原因,或者至少使该工具上传尽可能多的文件?
Its unclear which file is faulty and -c
flag doesn't make the tool continue upload as described. How can I determine what is causing the error or at least make the tool upload as many files as possible?
更新:使用 -D
开关,我可以将其追溯到以下错误
UPDATE: using the -D
switch I was able to trace it down to the following error
Comparing local vs cloud md5-checksum for tourism_studies/models/articles/54-moskva/slideshow/resized/7.jpg. (O8RgYfpRe8ylUbJh4UPfWg==/O8RgYfpRe8ylUbJh4UPfWg==)
Created: gs://www.gennadiy-dolzhenko.ru/tourism_studies/models/articles/54-moskva/slideshow/resized/7.jpg#1403367381161000
'ascii' codec can't decode byte 0xdd in position 1: ordinal not in range(128)
Encountered exception while copying:
Traceback (most recent call last):
File "/home/evgeniy/gsutil/gslib/command.py", line 1105, in _SequentialApply
args = args_iterator.next()
File "/home/evgeniy/gsutil/gslib/plurality_checkable_iterator.py", line 57, in _PopulateHead
e = self.base_iterator.next()
File "/home/evgeniy/gsutil/gslib/name_expansion.py", line 294, in __iter__
for (names_container, blr) in post_step3_iter:
File "/home/evgeniy/gsutil/gslib/plurality_checkable_iterator.py", line 57, in _PopulateHead
e = self.base_iterator.next()
File "/home/evgeniy/gsutil/gslib/name_expansion.py", line 521, in __iter__
for (names_container, blr) in self.tuple_iter:
File "/home/evgeniy/gsutil/gslib/plurality_checkable_iterator.py", line 57, in _PopulateHead
e = self.base_iterator.next()
File "/home/evgeniy/gsutil/gslib/name_expansion.py", line 580, in __iter__
for exp_blr in implicit_subdir_iterator:
File "/home/evgeniy/gsutil/gslib/plurality_checkable_iterator.py", line 57, in _PopulateHead
e = self.base_iterator.next()
File "/home/evgeniy/gsutil/gslib/wildcard_iterator.py", line 560, in IterAll
for bucket_listing_ref in self.__iter__():
File "/home/evgeniy/gsutil/gslib/wildcard_iterator.py", line 519, in __iter__
for filepath in filepaths:
File "/home/evgeniy/gsutil/gslib/wildcard_iterator.py", line 530, in _IterDir
for dirpath, unused_dirnames, filenames in os.walk(directory):
File "/usr/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/usr/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/usr/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/usr/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/usr/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/usr/lib/python2.7/os.py", line 284, in walk
if isdir(join(top, name)):
File "/usr/lib/python2.7/posixpath.py", line 80, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xdd in position 1: ordinal not in range(128)
推荐答案
这里的问题是文件名包含无效的Unicode字符.我们已更改gsutil,以在这种情况下提供更有用的错误消息.此更改将包含在gsutil 4.4中.
The problem here was a file name containing invalid Unicode chars. We have changed gsutil to provide a more helpful error message for this case. This change will be included in gsutil 4.4.
这篇关于gsutil无法使用“编解码器无法解码字节"上传文件,错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!