pimoroni / unicorn-hat

Python library for Unicorn pHAT and HAT. 32 or 64 blinding ws2812 pixels for your Raspberry Pi
https://shop.pimoroni.com/products/unicorn-hat
MIT License
370 stars 131 forks source link

Think I've done something wrong (AttributeError: 'module' object has no attribute etc) #54

Closed alexellis closed 8 years ago

alexellis commented 8 years ago

Think I've done something wrong here I am getting an error for all the methods on the unicorn library.

Expected: LEDs to turn on etc

Actual:

AttributeError: 'module' object has no attribute 'set_pixel'

AttributeError: 'module' object has no attribute 'show'

pi@dac:~/unicorn-hat/python/examples $ sudo pip2 install --upgrade unicornhat
Requirement already up-to-date: unicornhat in /usr/local/lib/python2.7/dist-packages/unicornhat-2.1.0-py2.7.egg
Requirement already up-to-date: rpi-ws281x>=2.0.0 in /usr/local/lib/python2.7/dist-packages/rpi_ws281x-2.0.1-py2.7-linux-armv6l.egg (from unicornhat)
Cleaning up...
pi@dac:~/unicorn-hat/python/examples $ sudo python2
Python 2.7.9 (default, Mar  8 2015, 00:52:26) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import unicornhat as uh
>>> uh.show()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'show'
>>> 

Few more:

pi@dac:~/unicorn-hat/python/examples $ python2 clock.py 
Traceback (most recent call last):
  File "clock.py", line 33, in <module>
    unicorn.rotation(0)
AttributeError: 'module' object has no attribute 'rotation'
pi@dac:~/unicorn-hat/python/examples $ python2 simple.py 
Traceback (most recent call last):
  File "simple.py", line 8, in <module>
    UH.set_pixel(x,y,255,0,255)
AttributeError: 'module' object has no attribute 'set_pixel'
pi@dac:~/unicorn-hat/python/examples $ python2 snow.py 
Traceback (most recent call last):
  File "snow.py", line 12, in <module>
    unicorn.brightness(0.4)
AttributeError: 'module' object has no attribute 'brightness'
pi@dac:~/unicorn-hat/python/examples $ 
alexellis commented 8 years ago

Remove + install fixed.