Closed ghalfacree closed 5 years ago
Actually, to correct myself, Pimoroni/unicornhat/matrix.py
works fine, but Pimoroni/unicornhat/examples/hat/matrix.py
does not:
$ sudo examples/hat/matrix.py
Matrix
Follow the white rabbit...
Traceback (most recent call last):
File "matrix.py", line 14, in <module>
unicorn.set_layout(unicorn.HAT)
AttributeError: 'module' object has no attribute 'set_layout'
Diff:
$ diff matrix.py examples/hat/matrix.py
3,4d2
< import unicornhat as unicorn
< from random import randint
5a4,12
> from random import randint
>
> import unicornhat as unicorn
>
>
> print("""Matrix
>
> Follow the white rabbit...
> """)
7c14
< unicorn.brightness(0.20)
---
> unicorn.set_layout(unicorn.HAT)
8a16
> unicorn.brightness(0.5)
Try reinstalling the library- this looks suspiciously like file corruption:
sudo pip install -I unicornhat
If memory serves, that will reinstall unicornhat
, ignoring any existing installs.
@Gadgetoid You're not wrong: that's fixed it. Ta!
Excellent! Happy hacking.
Fully up-to-date Raspbian running on a Raspberry Pi Zero with original low-resolution Unicorn HAT. Examples installed via curl'd script with all "yes please" optional stuff selected. Many examples - like matrix.py - work fine, but a few don't.
Steps to Recreate
Install and update Raspbian. Install and update Pimoroni Unicorn HAT software.
Reinstalling the examples changes nothing; neither does installing them via git instead.
Any ideas?