ericpulvino / pyBusylight

A python library to control Busylight devices based on pyusb.
MIT License
6 stars 8 forks source link

No backend available #1

Closed j6k4m8 closed 6 years ago

j6k4m8 commented 6 years ago

When running the test code from the readme, it throws this error:

NoBackendError                            Traceback (most recent call last)
<ipython-input-6-695313e87b17> in <module>()
----> 1 test = pybusylight.busylight()

~//pyBusylight/pybusylight.py in __init__(self, debug)
     18         self.ep = None
     19         self.debug = debug
---> 20         self.__connect_busylight__()
     21         self.red = 255
     22         self.green = 255

~//pyBusylight/pybusylight.py in __connect_busylight__(self)
     27
     28     def __connect_busylight__(self):
---> 29         dev = usb.core.find(idVendor=0x04d8, idProduct=0xf848)
     30
     31         if dev is None: raise ValueError('Device not found')

/usr/local/lib/python3.7/site-packages/usb/core.py in find(find_all, backend, custom_match, **args)
   1261                 break
   1262         else:
-> 1263             raise NoBackendError('No backend available')
   1264
   1265     if find_all:

NoBackendError: No backend available

This is the line that's failing:

https://github.com/ericpulvino/pyBusylight/blob/31f37184736a973e409fdd8f808b1c1c0456110d/pybusylight.py#L29

[EDIT] The above line conflicts with my system's reported product/vendor IDs:

Product ID: 0x3bcd Vendor ID: 0x27bb

ericpulvino commented 6 years ago

This looks to be an issue with the component of pyusb. Pyusb supports any of 3 different backends but they are not installed by default.

The most common backend is called libusb per https://github.com/pyusb/pyusb/issues/120

If you're on a MAC you can install libusb via: brew install libusb

On Windows you can follow the info here. https://github.com/walac/pyusb/blob/master/README.rst#installing

On Ubuntu 16.04/18.04 sudo apt-get install libusb-1.0-0

What kind of system are you on?

j6k4m8 commented 6 years ago

On a mac — libusb solved, thank you! Still having trouble with communicating with the light, but I'll see if I can figure it out before bugging you. Thank you!!

ericpulvino commented 6 years ago

Check out the example.py too to see all of the various things supported.

ericpulvino commented 6 years ago

Feel free to open another issue as well. Always happy to help. I've been meaning to put this in PyPi but I haven't gotten around to it yet.

ericpulvino commented 6 years ago

@j6k4m8 FYI I'm now catching this error in the most recent version.