Unicorn HAT HD rainbow.py IndexError: tuple index out of range


Hi, there.

A few times now, after leaving rainbow.py running for a few days, the display freezes, and Terminal spits out the following:

Traceback (most recent call last):
  File "./Pimoroni/unicornhathd/examples/rainbow.py", line 44, in <module>
  File "/usr/lib/python2.7/dist-packages/unicornhathd/__init__.py", line 140, in show
    _spi.xfer2([_SOF] + (numpy.rot90(_buf,_rotation).reshape(768) * _brightness).astype(numpy.uint8).tolist())
  File "/usr/lib/python2.7/dist-packages/numpy/lib/function_base.py", line 115, in rot90
    if axes[0] == axes[1] or absolute(axes[0] - axes[1]) == m.ndim:
IndexError: tuple index out of range

I’m still a total novice, but I’m wondering: is this essentially an integer overflow?


I’m not sure that it is- the only part of this traceback that should throw an index error is the axes[n] indexing, but since those values are hard-coded 1 and 0 for the X and Y axis (or Y and X I can’t recall!) they should never change/overflow.

Since the incrementing step value is not being fed directly into the underlying library, this must be a low-level bug and not related specifically to rainbow.py.

And… since the axes value in rot90 itself is, by default, (0, 1) I’m spectacularly stumped: