环境:
WIN7 / 64位
python2.7 / 32位
pywinauto / 0.6.3
target_app / 32位
代码:
?.
错误:
app = Application().connect(path='C:\\new_tdx_zcgl\\TdxW.exe')
while not app.windows_() or not app.TdxW_MainFrame_Class.Exists():
time.sleep(.5)
_list = app.TdxW_MainFrame_Class.ListView
cols = _list.Columns()
ites = _list.Items()
print "------------------------"
print "|".join([col["text"] for col in cols])
for i in range(_list.ItemCount()):
print "|".join([ites[i*len(cols)+j].Text()for j in range(len(cols))])
print "------------------------"
描述
当我致电Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\zd_python\my_pyauto.py", line 28, in <module>
print "|".join([ites[i*len(cols)+j].Text()for j in range(len(cols))])
File "C:\Anaconda2\lib\site-packages\pywinauto\controls\common_controls.py", line 194, in text
return self._readitem()[1]
File "C:\Anaconda2\lib\site- packages\pywinauto\controls\common_controls.py", line 167, in _readitem
', item_index = ' + str(self.item_index) + ', subitem_index = ' + str(self.subitem_index))
RuntimeError: We should never get to this part of ListView.get_item(), retval = 0, GetLastError() = 0, item_index = 0, subitem_index = 0
时,错误也会出现。
当我将python版本更改为64位时,错误仍然存在。
我可以获取ListView的item_count,但无法获取文本。
我的代码有什么问题,我该怎么办?