我尝试编译Firefox,因为我做了一些更改。但是当我尝试编译这些东西时,我收到了这个错误:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/threading.py", line 530, in __bootstrap_inner
self.run()
File "/usr/local/lib/python2.7/threading.py", line 483, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/ternes3/Downloads/mozilla-release/testing/mozbase/mozprocess/mozprocess/processhandler.py", line 698, in _processOutput
self.processOutputLine(line.rstrip())
File "/home/ternes3/Downloads/mozilla-release/testing/mozbase/mozprocess/mozprocess/processhandler.py", line 663, in processOutputLine
handler(line)
File "/home/ternes3/Downloads/mozilla-release/python/mach/mach/mixin/process.py", line 86, in handleLine
line_handler(line)
File "/home/ternes3/Downloads/mozilla-release/python/mozbuild/mozbuild/mach_commands.py", line 242, in on_line
self.log(logging.INFO, 'build_output', {'line': line}, '{line}')
File "/home/ternes3/Downloads/mozilla-release/python/mach/mach/mixin/logging.py", line 54, in log
extra={'action': action, 'params': params})
File "/usr/local/lib/python2.7/logging/__init__.py", line 1191, in log
self._log(level, msg, args, **kwargs)
File "/usr/local/lib/python2.7/logging/__init__.py", line 1246, in _log
self.handle(record)
File "/usr/local/lib/python2.7/logging/__init__.py", line 1256, in handle
self.callHandlers(record)
File "/usr/local/lib/python2.7/logging/__init__.py", line 1293, in callHandlers
hdlr.handle(record)
File "/usr/local/lib/python2.7/logging/__init__.py", line 740, in handle
self.emit(record)
File "/home/ternes3/Downloads/mozilla-release/python/mozbuild/mozbuild/mach_commands.py", line 75, in emit
self.fh.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xbb' in position 98: ordinal not in range(128)
我的构建系统是ArchLinux 64bit。我的更改基于Firefox 25 Source。我只改变设计的东西没有代码。
答案 0 :(得分:1)
有问题的代码基本上只是将某些内容记录到stdout。你的stdout(终端?)似乎不是utf-8或类似的已知到python编码。尝试将locale
设置为合理的,最好是utf-8。
您可以检查python将使用的stdout编码。执行python -c "import sys; print sys.stdout.encoding"
答案 1 :(得分:1)
尝试在脚本的开头添加:
import sys
sys.setdefaultencoding("utf-8")