0

当我从 Eclipse 运行 pyunit 时,PyUnit 视图未更新,并且出现以下错误

Finding files... done.
Importing test modules ... done.

----------------------------------------------------------------------
Ran 1 tests in 0.000s

OK
Traceback (most recent call last):
  File "C:\Program Files\eclipse\plugins\org.python.pydev.debug_2.4.0.2012020116\pysrc\pydev_runfiles_xml_rpc.py", line 131, in run
    self.server.notifyCommands(commands)
  File "C:\Python27\lib\xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "C:\Python27\lib\xmlrpclib.py", line 1575, in __request
    verbose=self.__verbose
  File "C:\Python27\lib\xmlrpclib.py", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "C:\Python27\lib\xmlrpclib.py", line 1297, in single_request
    return self.parse_response(response)
  File "C:\Python27\lib\xmlrpclib.py", line 1473, in parse_response
    return u.close()
  File "C:\Python27\lib\xmlrpclib.py", line 793, in close
    raise Fault(**self._stack[0])
Fault: <Fault 0: 'Failed to read XML-RPC request: Invalid byte 2 of 3-byte UTF-8 sequence.'>

您知道导致此错误的原因吗?

4

2 回答 2

0

该问题是由于对 eclipse 目录的访问权限不足(只读访问)引起的。我授予安装目录(修改)的权限,现在我没有这个错误。

于 2012-03-13T07:28:12.350 回答
0

我在 Eclipse 中使用 pyunit 时也遇到了这个错误。

我的问题是,在测试期间,尝试将 utf-8 字符串打印到 pyunit 控制台。转换字符串解决了这个问题:

问题代码:

print(my_Utf8_String)

固定的:

print (unicode(my_Utf8_String).encode('utf8'))
于 2012-06-29T14:34:18.907 回答