运行ride.py时报错
现象:
Traceback (most recent call last):
File “E:\Python27\lib\site-packages\robotide\application\application.py”, line 56, in OnInit
self.frame = RideFrame(self, self._controller)
File “E:\Python27\lib\site-packages\robotide\ui\mainframe.py”, line 166, in init
self._init_ui()
File “E:\Python27\lib\site-packages\robotide\ui\mainframe.py”, line 268, in _init_ui
self._application.settings)
File “E:\Python27\lib\site-packages\robotide\ui\tree.py”, line 85, in init
self._images = TreeImageList()
File “E:\Python27\lib\site-packages\robotide\ui\images.py”, line 42, in init
TestCaseController: _TreeImage(self, ‘robot.png’),
File “E:\Python27\lib\site-packages\robotide\ui\images.py”, line 80, in init
self.normal = self._get_image(image_list, normal)
File “E:\Python27\lib\site-packages\robotide\ui\images.py”, line 91, in _get_image
img = 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!
原因:
刚接触这个,什么也不懂,在网上查了很久,说是wxpython语言问题
解决办法:
试了一下,在E:\Python27\lib\site-packages\robotide\application\application.py这个文件中加入
self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
如下图:
注意事项:
加了之后,运行,发现报下面错误:
Traceback (most recent call last):
File “E:\Python27\lib\site-packages\robotide_init.py”, line 83, in main
run(inpath, not noupdatecheck, debug_console)
File “E:\Python27\lib\site-packages\robotide_init.py”, line 102, in run
from robotide.application import RIDE
File “E:\Python27\lib\site-packages\robotide\application_init.py”, line 16, in
from .application import RIDE, Project
File “E:\Python27\lib\site-packages\robotide\application\application.py”, line 50
self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
^
IndentationError: unexpected indent
解决办法是:我用的是Notepad++,视图>显示符号>显示空格与制表符,然后发现我加代码是缩进用的是tab键,其他的都是空格,然后查了一下,空格和tab键不能混用,最好用空格,所以我改成了空格,成功!
原文地址:http://www.pythonheidong.com/blog/article/53154/