1


我尝试编译 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 64 位。我的更改基于 Firefox 25 Source。我只改变了设计的东西,没有代码。

4

2 回答 2

1

尝试在脚本的开头添加它:

import sys
sys.setdefaultencoding("utf-8")
于 2013-11-13T07:48:48.097 回答
1

有问题的代码基本上只是将一些内容记录到标准输出。您的标准输出(终端?)似乎不是 utf-8 或类似的已知 python 编码。尝试将您的设置locale为合理的,最好是 utf-8。

您可以通过例如执行来检查 python 将使用的标准输出编码python -c "import sys; print sys.stdout.encoding"

于 2013-11-13T07:47:23.227 回答