Why is it giving me this error

Why is it giving me this key error??
Help will be greatly appreciated :slight_smile:

Looking at the traceback with error:

Traceback (most recent call last):
  File "main.py", line 15, in <module>
    food = Food()
  File "/home/runner/ELUtkiORl3o/food.py", line 7, in __init__
  File "/usr/lib/python3.8/turtle.py", line 3814, in __init__
    RawTurtle.__init__(self, Turtle._screen,
  File "/usr/lib/python3.8/turtle.py", line 2546, in __init__
    self.turtle = _TurtleImage(screen, shape)
  File "/usr/lib/python3.8/turtle.py", line 2489, in __init__
  File "/usr/lib/python3.8/turtle.py", line 2503, in _setshape
    self._type = screen._shapes[shapeIndex]._type
KeyError: <food.Food object at 0x7fd9e687bfd0>

The call from your code is super().__init__(self) from food.py file. Thatโ€™s the line Iโ€™d look closer at.

I forked your REPL and applied the techniques in this post and the error message disappeared!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.