IndexError: index 804 is out of bounds for axis 0 with size 800

Data Science Asked by R.SH on September 14, 2020

i installed a self driving car project from superdatascience site , when i open the map using terminal after a while the map window close up or it closes directly after i maximize the map window and it gives me this error :

    [INFO   ] [Base        ] Leaving application in progress...
 Traceback (most recent call last):
   File "", line 235, in <module>
   File "/usr/lib/python2.7/dist-packages/kivy/", line 826, in run
   File "/usr/lib/python2.7/dist-packages/kivy/", line 502, in runTouchApp
   File "/usr/lib/python2.7/dist-packages/kivy/core/window/", line 727, in mainloop
   File "/usr/lib/python2.7/dist-packages/kivy/core/window/", line 460, in _mainloop
   File "/usr/lib/python2.7/dist-packages/kivy/", line 340, in idle
   File "/usr/lib/python2.7/dist-packages/kivy/", line 325, in dispatch_input
   File "/usr/lib/python2.7/dist-packages/kivy/", line 231, in post_dispatch_input
     listener.dispatch('on_motion', etype, me)
   File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
   File "/usr/lib/python2.7/dist-packages/kivy/core/window/", line 1360, in on_motion
     self.dispatch('on_touch_down', me)
   File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
   File "/usr/lib/python2.7/dist-packages/kivy/core/window/", line 1376, in on_touch_down
     if w.dispatch('on_touch_down', touch):
   File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
   File "/usr/lib/python2.7/dist-packages/kivy/uix/", line 460, in on_touch_down
     if child.dispatch('on_touch_down', touch):
   File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
   File "", line 181, in on_touch_down
     sand[int(touch.x),int(touch.y)] = 1
 IndexError: index 620 is out of bounds for axis 1 with size 600

the code i have in the brain ( file ) is

    class Dqn():

    def select_action(self, state):
            probs = F.softmax(self.model(Variable(state, volatile = True))*100) # T=100
        action = probs.multinomial(num_samples=1)

the code i have in the map ( file ) is

class MyPaintWidget(Widget):

    def on_touch_down(self, touch):
        global length, n_points, last_x, last_y
        with self.canvas:
            d = 10.
            touch.ud['line'] = Line(points = (touch.x, touch.y), width = 10)
            last_x = int(touch.x)
            last_y = int(touch.y)
            n_points = 0
            length = 0
            sand[int(touch.x),int(touch.y)] = 1

what should i do or change ??

One Answer

One of the values being returned by touch.x or touch.y are bigger than the dimensions of the sand array.

You could try adding a try/except block around it and print a useful message - just as an example, as I have no idea what this programme is doing (in the on_touch_down function):

def on_touch_down(self, touch)
        sand[int(touch.x), int(touch.y)] = 1
    except IndexError:
        print("Touchdown did not occur within the end-zone! No goal!")

Answered by n1k31t4 on September 14, 2020

Add your own answers!

Related Questions

Is there any good alternative for Keras library?

4  Asked on January 7, 2021 by chinmay-kulkarni


Does this data work with Convolutional Neural Network

1  Asked on January 6, 2021 by a-a


Output landscape of ReLU, Swish and Mish

1  Asked on January 5, 2021 by shaurov2253


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir