问题描述
Traceback (most recent call last):
File "C:\Python\python37\lib\site-packages\pandas\core\indexes\base.py",line 3080,in get_loc
return self._engine.get_loc(casted_key)
File "pandas\_libs\index.pyx",line 70,in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\index.pyx",line 101,in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\hashtable_class_helper.pxi",line 1625,in pandas._libs.hashtable.Int64HashTable.get_item
File "pandas\_libs\hashtable_class_helper.pxi",line 1632,in pandas._libs.hashtable.Int64HashTable.get_item
KeyError: 20
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\muh\Desktop\RollercoinBot-master\bot.py",line 232,in <module>
main()
File "C:\Users\muh\Desktop\RollercoinBot-master\bot.py",line 226,in main
bot().play()
File "C:\Users\muh\Desktop\RollercoinBot-master\bot.py",line 161,in play
self.get_coin_fields()
File "C:\Users\muh\Desktop\RollercoinBot-master\bot.py",line 177,in get_coin_fields
self.coin_pos.append(matches['BBox'][i])
File "C:\Python\python37\lib\site-packages\pandas\core\series.py",line 824,in __getitem__
return self._get_value(key)
File "C:\Python\python37\lib\site-packages\pandas\core\series.py",line 932,in _get_value
loc = self.index.get_loc(label)
File "C:\Python\python37\lib\site-packages\pandas\core\indexes\base.py",line 3082,in get_loc
raise KeyError(key) from err
KeyError: 20
我无法解决这个问题。我花了很多时间在这上面,现在我放弃了。我做了一个机器人。我这样做是为了方便我,因为我不想在网站上花时间。第一次尝试时效果很好,但是当代码循环时,我收到了这样的错误。
def get_coin_fields(self):
screen = cv2.imread(screen_grab())
matches = matchTemplates(
[("card",cv2.imread("rc_items/coinflip_back.png"))],screen,N_object=float("inf"),score_threshold=0.5,#maxOverlap=0.25,searchBox=None)
for i in range(len(matches['BBox'])):
self.coin_pos.append(matches['BBox'][i])
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)