self-driving-car icon indicating copy to clipboard operation
self-driving-car copied to clipboard

Error Vertex

Open OktavianPrabowo opened this issue 5 years ago • 2 comments

I Have an error when i try your code

`TypeError Traceback (most recent call last) in () 1 fps_display = FPSDisplay(window) 2 ----> 3 maps = CarMap() 4 ai = Ai() 5 net = Net()

C:\WinPython\notebooks\Self Driving Car\Car_Map.py in init(self) 17 self.blue2 = [0, 97, 255, 1] * (2) 18 self.in_batch.add(len(self.in_map) / 2, pyglet.gl.GL_LINE_LOOP, None, ('v2i', self.in_map), ---> 19 ('c4B', self.in_grey * 4)) 20 self.out_batch.add(len(self.out_map) / 2, pyglet.gl.GL_LINE_LOOP, None, ('v2i', self.out_map), 21 ('c4B', self.out_grey * 4))

C:\WinPython\python-3.6.3.amd64\lib\site-packages\pyglet\graphics_init_.py in add(self, count, mode, group, *data) 365 366 # Create vertex list and initialize --> 367 vlist = domain.create(count) 368 for i, array in initial_arrays: 369 vlist._set_attribute_data(i, array)

C:\WinPython\python-3.6.3.amd64\lib\site-packages\pyglet\graphics\vertexdomain.py in create(self, count) 274 :rtype: VertexList 275 ''' --> 276 start = self._safe_alloc(count) 277 return VertexList(self, start, count) 278

C:\WinPython\python-3.6.3.amd64\lib\site-packages\pyglet\graphics\vertexdomain.py in _safe_alloc(self, count) 246 return self.allocator.alloc(count) 247 except allocation.AllocatorMemoryException as e: --> 248 capacity = _nearest_pow2(e.requested_capacity) 249 self._version += 1 250 for buffer, _ in self.buffer_attributes:

C:\WinPython\python-3.6.3.amd64\lib\site-packages\pyglet\graphics\vertexdomain.py in _nearest_pow2(v) 82 # Credit: Sean Anderson 83 v -= 1 ---> 84 v |= v >> 1 85 v |= v >> 2 86 v |= v >> 4

TypeError: unsupported operand type(s) for >>: 'float' and 'int'`

Can you help me to solve this problem??

OktavianPrabowo avatar May 01 '19 09:05 OktavianPrabowo

Im using Python 3 by the way

OktavianPrabowo avatar May 01 '19 09:05 OktavianPrabowo

it's seems that python 2.7 fixes every error for me. please try it and then tell if it work :)

rotem154154 avatar May 01 '19 19:05 rotem154154