Unicorn Hat on RPi v2 throws RuntimeError and DAM error

On RPi v2, installed Raspbian and my Unicorn Hat with python script

pi@raspberrypi ~/Pimoroni/unicornhat $ pwd

$ sudo python simple.py 
Can't open device file /tmp/mailbox-7729: Permission denied
Can't open device file /tmp/mailbox-7729: Permission denied
Can't open device file /tmp/mailbox-7729: Permission denied
Traceback (most recent call last):
  File "simple.py", line 3, in <module>
    import unicornhat as UH
  File "/usr/local/lib/python2.7/dist-packages/unicornhat.py", line 13, in <module>
  File "/usr/local/lib/python2.7/dist-packages/neopixel.py", line 100, in begin
    raise RuntimeError('ws2811_init failed with code {0}'.format(resp))
RuntimeError: ws2811_init failed with code -1
DMA Error: 76d362f0
munmap error -1

Any pointers are welcome.

I swear someone had a solution to this somewhere on the forums- I’ll see if I can dredge it up because the search box is failing me!

I don’t believe you’re doing anything wrong.

I’m not sure if this is related, but it sounds similar:


Unfortunately I don’t have a Pi in front of me right now to test this theory, or provide instructions for fixing it!

I tried again and it resolved by itself.

I reckon this was most likely a non-issue.

Thanks for trying to help

From memory i saw something similar to this. And resolved it this way, whether correct or not.
In short, when installing the RPI Unicorn hat library i forgot to run the install with SUDO. As such it did not have the correct permissions to run properly. Might be wrong, or unrelated, might even be that when i re-installed it just updated or solved it… but was somehting i experienced.