0
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

I cant solve this problem. I spent a lot of time on this and now I gave up. I made a bot. I did it for the convenience of me as I do not want to spend time on the site. It works fine on the first try but when the code loops I get an error like this.

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])
Henry Ecker
  • 34,399
  • 18
  • 41
  • 57
Ben WMean
  • 1
  • 1

0 Answers0