当前位置: 代码迷 >> 综合 >> robotframework安装与运行(ride.py1.7.4.2命令报错)(win10+python3.8.1)
  详细解决方案

robotframework安装与运行(ride.py1.7.4.2命令报错)(win10+python3.8.1)

热度:68   发布时间:2023-12-12 13:52:53.0

首先,robotframework必须在python的环境下运行

所以你的电脑里必须有python3.x的环境先。
在这里插入图片描述

上古时期的robotframework只支持python2,不过python2都已经停止更新和维护了,它也只能放下身段也支持python3了,它的前世今生就不在此过多赘述了。

接下来就是安装相关的库了。

通过pip命令直接安装。
pip install robotframework
pip install Pypubsub==3.3.0
pip install wxPython==4.0.3
pip install robotframework-ride
最后通过pip list命令来查看已安装的库。
在这里插入图片描述
ps:如果pip命令安装过慢或直接就安装失败,可以使用国内镜像安装,参考:https://zhuanlan.zhihu.com/p/61696526

最后一步就是输入命令ride.py,打开RIDE界面了。

但是我在这一步遇到了报错,具体如下:

<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 0.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 3.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 4.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 5.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 6.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 7.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 19.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 20.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 21.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 22.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 25.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 26.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 27.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 28.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 29.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 30.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 31.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 32.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 33.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 34.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 35.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 36.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 37.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 38.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 39.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 40.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 43.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 44.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 45.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 46.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 47.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 48.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 49.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 50.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 51.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 52.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 53.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 54.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 55.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 56.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 57.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 58.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 59.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 60.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 61.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 62.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 63.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 67.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 68.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 69.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 70.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 71.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 13.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 14.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 0.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 3.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 4.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 5.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 6.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 7.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 19.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 20.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 21.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 22.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 25.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 26.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 27.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 28.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 29.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 30.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 31.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 32.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 33.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 34.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 35.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 36.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 37.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 38.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 39.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 40.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 43.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 44.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 45.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 46.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 47.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 48.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 49.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 50.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 51.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 52.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 53.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 54.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 55.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 56.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 57.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 58.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 59.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 60.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 61.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 62.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 63.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 67.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 68.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 69.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 70.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 71.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 13.
Traceback (most recent call last):File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\robotide\application\application.py", line 58, in OnInitself.frame = RideFrame(self, self._controller)File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\robotide\ui\mainframe.py", line 175, in __init__self._init_ui()File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\robotide\ui\mainframe.py", line 279, in _init_uiself.tree = Tree(self, self.actions,File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\robotide\ui\tree.py", line 86, in __init__self._images = TreeImageList()File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\robotide\ui\images.py", line 42, in __init__TestCaseController: _TreeImage(self, 'robot.png'),File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\robotide\ui\images.py", line 80, in __init__self.normal = self._get_image(image_list, normal)File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\robotide\ui\images.py", line 91, in _get_imageimg = wx.Image(path, wx.BITMAP_TYPE_PNG).ConvertToBitmap()
wx._core.wxAssertionError: C++ assertion "strcmp(setlocale(LC_ALL, NULL), "C") == 0" failed at ..\..\src\common\intl.cpp(1579) in wxLocale::GetInfo(): You probably called setlocale() directly instead of using wxLocale and now there is a mismatch between C/C++ and Windows locale.
Things are going to break, please only change locale by creating wxLocale objects to avoid this!
OnInit returned false, exiting...
Error in atexit._run_exitfuncs:
wx._core.wxAssertionError: C++ assertion "GetEventHandler() == this" failed at ..\..\src\common\wincmn.cpp(478) in wxWindowBase::~wxWindowBase(): any pushed event handlers must have been removed

解决办法。

我在GitHub上找到如下一句话:
在这里插入图片描述

而我的版本正好就是这样(python3.8,ride1.7.4.2):
在这里插入图片描述
在这里插入图片描述
emmmm…
github上对我这种情况提供了短暂的解决办法:
在这里插入图片描述
执行此条命令:
在这里插入图片描述
ride发生变化:
在这里插入图片描述

在这里插入图片描述

这样再输入命令ride.py就可以打开RIDE界面啦
在这里插入图片描述

ps:我的这种情况发生在python3.8,ride1.7.4.2的情况下。ride的下一版本为2.0,可以适配python3.8,到时就不会出现我这个问题了

可以去GitHub的robotframework看看项目的最新进展:https://github.com/robotframework/RIDE
在这里插入图片描述

最后总结一下出现这个问题的原因,robotframework一开始是只兼容到python2.7的,后来python2.x停止更新,robotframework出了个最新的版本,支持到python3.7,然后新的版本还没出,python3.8及以后版本的python是不支持的。等到后面robotframework出了新的版本就会兼容最新版本的python。

  相关解决方案