Import Error using blinkt library


#1

I’ve got a blinkt connected to a new Pi Zero but I am having problems getting the python library to work.

I’ve installed things following the instructions at https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-blinkt and everything seems to have succeeded.

When I follow the examples I get the following…

➜  development sudo python
Python 2.7.9 (default, Sep 17 2016, 20:26:04)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information. 
>>> from blinkt import set_pixel, set_brightness, show, clear
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "blinkt.py", line 1, in <module>
    from blinkt import set_pixel, set_brightness, show, clear
ImportError: cannot import name set_pixel

I’ve apt-get updated and upgrade everything and rebooted the pi several times. Can you help me get started?

Thanks


#2

It’s working now. No idea why…


#3

It might be because your code file was called blinkt.py. This confuses Python as is can’t tell where the library called blinkt is actually located.


#4

thanks - you’re probably right. I did delete the file before it started working.