# Unicorn Hat Not Working - Python syntax errors

**URL:** <https://forums.pimoroni.com/t/unicorn-hat-not-working-python-syntax-errors/8155>\
**Category:** Support\
**Created:** [July 17, 2018, 7:14pm UTC](https://forums.pimoroni.com/t/unicorn-hat-not-working-python-syntax-errors/8155 "2018-07-17T19:14:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![geekyteach](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/geekyteach/32/4332_2.png) [@geekyteach](https://forums.pimoroni.com/u/geekyteach)\
**Post date:** [July 17, 2018, 7:14pm UTC](https://forums.pimoroni.com/t/unicorn-hat-not-working-python-syntax-errors/8155/1 "2018-07-17T19:14:09Z")

</div>

Hi,

My friend and I are attempting to get his Unicorn Hat working, with no luck. We’ve updated Raspbian, run curl [https://get.pimoroni.com/unicornhat](https://get.pimoroni.com/unicornhat) | bash, and followed the steps in multiple tutorials. We seem to be having an issue - problem is we’re not sure if it’s a hardware issue, a software issue, or PEBKAC.

When we use terminal to run sudo python ./simple.py it runs with no visible errors, but nothing actually happens on the unicorn hat. No lights at all.

When we attempt to run a program such as  
import colorsys as col  
import unicornhat as uh

def set\_pixel\_hsv(x, y, h, s, v):  
r, g, b = [int(x\*255) for x in col.hsv\_to\_rgb(h,s,v)]  
uh.set\_pixel(x,y,r,g,b)

we get the following error

> > > %Run unicornhat.py  
> > > File “/home/pi/unicornhat.py”, line 29  
> > > )import unicornhat as uh  
> > > ^  
> > > SyntaxError: invalid syntax

Looking at unicornhat.py, it shows:  
)import unicornhat as uh

uh.set\_layout(uh.HAT)

We’re a bit stumped as to how to proceed with this. Any help would be appreciated!

Thanks  
Meredith & Billy

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [July 17, 2018, 9:44pm UTC](https://forums.pimoroni.com/t/unicorn-hat-not-working-python-syntax-errors/8155/2 "2018-07-17T21:44:54Z")

</div>

Are you using a Unicorn HAT, or a Unicorn HAT HD? They require different software, which may be causing you woes!

Your “SyntaxError” is due to an erroneous “)” before the “import unicornhat as uh”. You’ll also find that if you name your test file “unicornhat.py” and then try to “import unicornhat” the script will simply import itself instead of the Unicorn HAt library and fail miserably.
