1.在Python>>Scripts中运行python ride.py时报错
现象:
1 Traceback (most recent call last): 2 File “E:\Python27\lib\site-packages\robotide\application\application.py”, line 56, in OnInit 3 self.frame = RideFrame(self, self._controller) 4 File “E:\Python27\lib\site-packages\robotide\ui\mainframe.py”, line 166, in init 5 self._init_ui() 6 File “E:\Python27\lib\site-packages\robotide\ui\mainframe.py”, line 268, in _init_ui 7 self._application.settings) 8 File “E:\Python27\lib\site-packages\robotide\ui\tree.py”, line 85, in init 9 self._images = TreeImageList() 10 File “E:\Python27\lib\site-packages\robotide\ui\images.py”, line 42, in init 11 TestCaseController: _TreeImage(self, ‘robot.png’), 12 File “E:\Python27\lib\site-packages\robotide\ui\images.py”, line 80, in init 13 self.normal = self._get_image(image_list, normal) 14 File “E:\Python27\lib\site-packages\robotide\ui\images.py”, line 91, in _get_image 15 img = wx.Image(path, wx.BITMAP_TYPE_PNG).ConvertToBitmap() 16 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. 17 Things are going to break, please only change locale by creating wxLocale objects to avoid this!
原因:
wxpython语言问题解决办法:
在E:\Python37\lib\site-packages\robotide\application\application.py这个文件中加入 1 self.locale = wx.Locale(wx.LANGUAGE_ENGLISH) 如下图:
注意事项:
如果加了之后,运行,发现报下面错误:1 Traceback (most recent call last): 2 File "E:\Python27\lib\site-packages\robotide_init.py", line 83, in main 3 run(inpath, not noupdatecheck, debug_console) 4 File "E:\Python27\lib\site-packages\robotide_init.py", line 102, in run 5 from robotide.application import RIDE 6 File "E:\Python27\lib\site-packages\robotide\application_init.py", line 16, in 7 from .application import RIDE, Project 8 File “E:\Python27\lib\site-packages\robotide\application\application.py”, line 50 9 self.locale = wx.Locale(wx.LANGUAGE_ENGLISH) 10 ^ 11 IndentationError: unexpected indent解决办法: 用Notepad++,视图>显示符号>显示空格与制表符,发现加的代码缩进用的是tab键,其他的都是空格,经查阅,空格和tab键不能混用,最好用空格。
2.执行脚本报错:command: "no pybot" --argumentfile C:\Users\11643\AppData\Local\Temp\RIDE3zb6cxzd.d\argfile.txt
解决方式:
在 Scripts 目录下加一个pybot.bat文件,内容为: 1 @Echo off 2 python -m robot.run %*再将Execution Profile设置为robot,执行成功!
3.使用Robotframework-ride,导入Selenium2Library库后缺少“Open Browser”关键字
原因一:
robotframework的版本太高或太低导致解决办法:
先卸载robotframework:pip uninstall robotframework 再安装3.1.2版本: pip install robotframework==3.1.2原因二:
robotframework-pythonlibcore的版本太高解决办法:
先卸载robotframework-pythonlibcore:pip uninstall robotframework-pythonlibcore 再安装2.1.0版本:pip install robotframework-pythonlibcore==2.1.0Tip:目前遇到缺少关键字的原因已列出,后续如果还是遇到以上方法不能解决的,解决思路是:将通过pip命令安装的各个库的版本降低,可参照已成功安装的机器(以下截图中为正常可使用的,含目前本人已使用的全部库)。
标签:常见问题,lib,robotide,py,Robot,site,Framework,Python27,packages From: https://www.cnblogs.com/TotheAnts/p/17587857.html