arvydas / blinkstick-python

BlinkStick Python interface to control devices connected to the computer
Other
136 stars 53 forks source link

Python3 description needed. #82

Closed dolikemedo closed 2 years ago

dolikemedo commented 2 years ago

Hello!

Forgive my manners. Can someone provide a python3 description for this? I've been looking everywhere and some say this wont work with python3.

The installation steps were followed, yet I get this error: /usr/bin/env: ‘python\r’: No such file or directory

I've tried installing pip2 package, pip2 module, tried all the possible shebangs, tried running with python2 nothing happens, I cant make it to work.

Thanks if anyone can help! Cheers

dolikemedo commented 2 years ago

Okay, it works from interactive python3 interpreter, I guess I need to learn more...

dolikemedo commented 2 years ago

Still cant make commandline tool happen.

uname -a
Linux BB-8 5.13.0-44-generic #49~20.04.1-Ubuntu SMP Wed May 18 18:44:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
python -V
Python 3.8.10
python3 -V
Python 3.8.10
python2 -V
Python 2.7.18
pip3 list | grep blink
blinker                 1.4                 
pip list | grep blink
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.

pip2 list | grep blink
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.

I have installed the library. It worked from interactive python.

dolikemedo commented 2 years ago

Okay, I could finally install it by cloning the repo and: sudo python3 setup.py install but I cant set the udev-rule:

sudo blinkstick --add-udev-rule
Rule added to {0}
Traceback (most recent call last):
  File "/usr/local/bin/blinkstick", line 4, in <module>
    __import__('pkg_resources').run_script('BlinkStick==1.2.0', 'blinkstick')
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 667, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1470, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/local/lib/python3.8/dist-packages/BlinkStick-1.2.0-py3.8.egg/EGG-INFO/scripts/blinkstick", line 330, in <module>
  File "/usr/local/lib/python3.8/dist-packages/BlinkStick-1.2.0-py3.8.egg/EGG-INFO/scripts/blinkstick", line 236, in main
AttributeError: 'NoneType' object has no attribute 'format'
dolikemedo commented 2 years ago

Okay I got it.

  1. clone repo
  2. edit /bin/binstick line 236 to :
    print("Rule added to {0}".format(filename))
  3. sudo python3 setup.py install
  4. sudo blinkstick --add-udev-rule

blinkstick --info blinkstick --morph blue