从谷歌闭包库运行 depswriter.py 时出错

问题描述 投票:0回答:2

我正在尝试按照此链接在 Oracle VirtualBox 上运行的 Linux 上构建 XTK,以获得非缩小的

xtk.js
。当我尝试在运行
xtk-deps.js
文件时生成
deps.py
时,出现以下错误:

Generating dependency file for XTK...
Traceback (most recent call last):
File "/root/Downloads/X-master/lib/google-closure-library/closure/bin/build/depswriter.py", line 212, in <module>
main()
File "/root/Downloads/X-master/lib/google-closure-library/closure/bin/build/depswriter.py", line 196, in main
path_to_source[depspath] = source.Source(source.GetFileContents(srcpath))
File "/root/Downloads/X-master/lib/google-closure-library/closure/bin/build/source.py", line 126, in GetFileContents
return fileobj.read()
File "/usr/lib/python2.7/codecs.py", line 668, in read
return self.reader.read(size)
File "/usr/lib/python2.7/codecs.py", line 474, in read
newchars, decodedbytes = self.decode(data, self.errors)
File "/usr/lib/python2.7/encodings/utf_8_sig.py", line 104, in decode
return codecs.utf_8_decode(input, errors)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x9a in position 4584: invalid start byte
Could not generate dependency file.  

有人可以解释一下为什么会出现这个错误吗?

google-closure-compiler google-closure-library xtk
2个回答
0
投票

您的代码中可能存在一些非 uft8 字符(最有可能在 X.js 中)。

以我的经验为例,在XTK的X.js中,我发现第210行有一个非英语单词(可能是德语或法语名称)。我所做的就是删除该角色并再次运行 build.py 。编码错误没有再次出现。


0
投票

对我有用的是,我使用了早期提交的 google 闭包库 来构建 XTK 并且它工作得很好。
我必须广泛搜索 XTK 的提交历史记录,才能了解他们使用哪个版本的闭包库来构建它。

© www.soinside.com 2019 - 2024. All rights reserved.