Permission denied errors in CLI

Hi, I installed the blinkstick python module in a virtual env. Can’t even get the help or info commands to run

Φ blinkstick
zsh: permission denied: blinkstick

With sudo directly:

sudo python3 blinkstick
Traceback (most recent call last):
  File "blinkstick", line 4, in <module>
    from blinkstick import blinkstick
ModuleNotFoundError: No module named 'blinkstick'

Installing it straight to the system (both with sudo and without) results in the same errors

1 Like

1st one, chmod +x blinkstick
2nd one, try: https://github.com/olafrv/blinkstick_square

Neither work. There is no blinkstick to +x to. Unless you mean the blinkstick.py file in the package.

The other project just outputs this when trying to run

17:07 PM Φ uvicorn server:app
Traceback (most recent call last):
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/bin/uvicorn", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/uvicorn/main.py", line 416, in main
    run(
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/uvicorn/main.py", line 587, in run
    server.run()
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/uvicorn/server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/uvicorn/server.py", line 68, in serve
    config.load()
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/uvicorn/config.py", line 467, in load
    self.loaded_app = import_from_string(self.app)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/uvicorn/importer.py", line 21, in import_from_string
    module = importlib.import_module(module_str)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/uname/operational/code/doblink/blinkstick_square/server.py", line 27, in <module>
    bs = blinkstick.find_first()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uname/operational/code/doblink/blinkstick_square/blinkstick_python/blinkstick/blinkstick.py", line 1585, in find_first
    return BlinkStick(device=d)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/uname/operational/code/doblink/blinkstick_square/blinkstick_python/blinkstick/blinkstick.py", line 218, in __init__
    self.open_device(device)
  File "/home/uname/operational/code/doblink/blinkstick_square/blinkstick_python/blinkstick/blinkstick.py", line 823, in open_device
    if self.device.is_kernel_driver_active(0):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/usb/core.py", line 1107, in is_kernel_driver_active
    self._ctx.managed_open()
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/usb/core.py", line 113, in wrapper
    return f(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/usb/core.py", line 131, in managed_open
    self.handle = self.backend.open_device(self.dev)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/usb/backend/libusb1.py", line 804, in open_device
    return _DeviceHandle(dev)
           ^^^^^^^^^^^^^^^^^^
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/usb/backend/libusb1.py", line 652, in __init__
    _check(_lib.libusb_open(self.devid, byref(self.handle)))
  File "/home/uname/operational/code/doblink/blinkstick_square/blink/lib/python3.11/site-packages/usb/backend/libusb1.py", line 604, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 13] Access denied (insufficient permissions)