Closed westwind79 closed 6 years ago
Also reported here: https://forums.pimoroni.com/t/unicorn-hat-hd-stars-py-not-working/6125/3
Looks like the output of random.uniform
needs coercing into an integer.
I have fixed this with a simple cast to integer of the values used to index _buf
internally to the library. This should keep code examples tidier.
This issue arose because, as of NumPy 1.12.0, the ability to use floats as indices for an array was changed from a deprecation warning, to an error.
Traceback (most recent call last): File "stars.py", line 41, in
unicornhathd.set_pixel(stars[i][0], stars[i][1], v, v, v)
File "/usr/lib/python2.7/dist-packages/unicornhathd/init.py", line 79, in set_pixel
_buf[x][y] = r, g, b
IndexError: only integers, slices (
:
), ellipsis (...
), numpy.newaxis (None
) and integer or boolean arrays are valid indices