Unicorn HAT HD programs not working

Hello all,
I was so happy to get my Unicorn Hat HD in the mail today, but I am having problem running the example programs.

I am using raspbian stretch on my pi3, and I installed the unicorn using
curl https://get.pimoroni.com/unicornhathd | bash

but when I ran the example programs. I get the following exception:

Traceback (most recent call last):
File “demo.py”, line 6, in
import unicornhathd
File “/usr/lib/python3/dist-packages/unicornhathd/init.py”, line 20, in
_spi.open(0, 0)
FileNotFoundError: [Errno 2] No such file or directory

What did I do wrong?

Hi there @dilhilar, did your curl command complete without errors? It looks to be like the unicornhathd files cannot be found on your system where they ought to be.

Also, what version of Python where you using? Have a go at using Python 2.X, since Stretch is still a little unstable with most of the Pimoroni products. :D

Looks like SPI didn’t get enabled. Try enabling with:

sudo raspi-config nonint do_spi 0
sudo reboot
1 Like

thanks for the replies.

i am using python3 that came with raspbian stretch. i did the curl command, and it completed without error. i ran it again and it said SPI Already Enabled.

also ran sudo raspi-config nonint do_spi 0, nothing changed after reboot.

is raspbian stretch not supported yet? i will try a jessie image now. hope my hat is not dead on arrival. :(

i reinstalled stretch on the same sd card, and it worked. don’t know why, but it is working now, thanks guys.

1 Like

Great news. It could have been a hiccup in the install script the first time. Stretch is supported- we already ship it on our NOOBS cards- but these sorts of things happen. Glad you’re up and running!