zoukankan      html  css  js  c++  java
  • robotframework运行时后台报错UnicodeDecodeError

    win10环境下报错:

    Traceback (most recent call last):

      File "C:Python27libsite-packages obotidecontrib estrunner estrunnerplugin.py", line 370, in OnTimer

        self._test_runner.get_output_and_errors(self.get_current_profile())

      File "C:Python27libsite-packages obotidecontrib estrunner estrunner.py", line 250, in get_output_and_errors

        stdout, stderr, returncode = self._process.get_output(),

      File "C:Python27libsite-packages obotidecontrib estrunner estrunner.py", line 305, in get_output

        return self._output_stream.pop()

      File "C:Python27libsite-packages obotidecontrib estrunner estrunner.py", line 400, in pop

        return result.decode('UTF-8')

      File "C:Python27libencodingsutf_8.py", line 16, in decode

        return codecs.utf_8_decode(input, errors, True)

    UnicodeDecodeError: 'utf8' codec can't decode byte 0xb2 in position 5: invalid start byte

    Traceback (most recent call last):

      File "C:Python27libsite-packages obotidecontrib estrunner estrunnerplugin.py", line 370, in OnTimer

        self._test_runner.get_output_and_errors(self.get_current_profile())

      File "C:Python27libsite-packages obotidecontrib estrunner estrunner.py", line 250, in get_output_and_errors

        stdout, stderr, returncode = self._process.get_output(),

      File "C:Python27libsite-packages obotidecontrib estrunner estrunner.py", line 305, in get_output

        return self._output_stream.pop()

      File "C:Python27libsite-packages obotidecontrib estrunner estrunner.py", line 400, in pop

        return result.decode('UTF-8')

      File "C:Python27libencodingsutf_8.py", line 16, in decode

        return codecs.utf_8_decode(input, errors, True)

    UnicodeDecodeError: 'utf8' codec can't decode byte 0xb2 in position 279: invalid start byte

    解决方案:在line400行报错utf8编码0xb2解码:无效

    我们每次在修改了testrunner.py文件后一定要记得删掉testrunner.pyc文件,然后重新启动ride,不然等于白改~!

        def pop(self):

            result = ""

            for _ in xrange(self._queue.qsize()):

                try:

                    result += self._queue.get_nowait()

                except Empty:

                    pass

            return result.decode('UTF-8')

    把UTF-8改成GBK

    然后解决问题!

  • 相关阅读:
    Entity Framework 出现 "此 ObjectContext 实例已释放,不可再用于需要连接的操作" 的错误
    JS 页面加载触发事件 document.ready和window.onload的区别
    C# 控制台程序实现 Ctrl + V 粘贴功能
    网站推广必备的16个营销工具
    C# 如何捕获键盘按钮和组合键以及KeyPress/KeyDown事件之间的区别 (附KeyChar/KeyCode值)
    jQuery问题集锦
    zend studio打开文件提示unsupported character encoding
    简单的Jquery焦点图切换效果
    HTML实体符号代码速查表
    心得感悟
  • 原文地址:https://www.cnblogs.com/lxs1314/p/8965995.html
Copyright © 2011-2022 走看看