ImportError: cannot import name blinkstick

Hello, I’m new to the forum and have a BlinkStick Square which I’m trying to use with Python on Linux and also a Raspberry Pi, but unfortunately I’m having the same problem on both devices.

I successfully control the BlinkStick on both devices via the command line, but when I try and control it via Python, I run into the errors below:

pi@RaspberryPi4Flirc:~/IO $ python2.7 blinkpython.py
Traceback (most recent call last): File "blinkpython.py", line 3, in <module> from blinkstick import blinkstick File "/home/pi/IO/blinkstick.py", line 1, in <module> from blinkstick import blinkstick 
ImportError: cannot import name blinkstick

pi@RaspberryPi4Flirc:~/IO $ sudo python2.7 blinkpython.py
Traceback (most recent call last): File "blinkpython.py", line 3, in <module> from blinkstick import blinkstick File "/home/pi/SonosProject/IO/blinkstick.py", line 1, in <module> from blinkstick import blinkstick 
ImportError: cannot import name blinkstick

pi@RaspberryPi4Flirc:~/IO $ python3 blinkpython.pyTraceback (most recent call last): File "blinkpython.py", line 3, in <module> from blinkstick import blinkstick File "/home/pi/SonosProject/IO/blinkstick.py", line 1, in <module> from blinkstick import blinkstick 
ImportError: cannot import name 'blinkstick' from 'blinkstick' (/home/pi/IO/blinkstick.py)

The line of code which keeps throwing errors is simply this:

from blinkstick import blinkstick

I’ve installed everything as per here: https://www.blinkstick.com/help/raspberry-pi-integration and I believe I did it correctly. I’ve seen similar posts in the forum and followed those instructions as well, but the issue wasn’t exactly the same so it didn’t lead me anywhere but here.

Many thanks for any help

Do you have a file named blinkstick.py in folder /home/pi/IO ?

Can you also try running

blinkstick --info 

in the command prompt with your BlinkStick plugged in and let me know the output?

Ha! Well look at that. Once I renamed the blinkstick.py file I had stupidly in the same folder, it works as expected. Thank you very much for the help.

For completeness, here is what I get with blinkstick --info:

Found device:
    Manufacturer:  Agile Innovative Ltd
    Description:   BlinkStick
    Serial:        private
    Current Color: #7b162e
    Mode:          2
    LEDs:          unsupported
    Info Block 1:
    Info Block 2: