PyUSB ValueError: no backend available

I am running Python 2.7.8 on the Win 7 operating system. I am trying to transfer a USB device (Numato 32-channel GPIO device) from PyUSB.

I downloaded walac-pyusb-7071ad3 from the URL: http://walac.imtqy.com/pyusb

I stop receiving "ValueError: no backend." Can any Python expert tell me where is wrong?

Here is the code:

import sys
import usb
import usb.core
import usb.util
import usb.backend.libusb1

backend = usb.backend.libusb1.get_backend(find_library=lambda C:'\Python27')
numato = usb.core.find(idVendor=00000006,idProduct = 00000000, backend=backend)

Here is the Python error message:

Traceback (most recent call last):
  File "C:\Python_Yang\PyUSBNumato.py", line 19, in <module>
    numato = usb.core.find(idVendor=00000006,idProduct = 00000000, backend=backend)
  File "C:\Python_Yang\usb\core.py", line 1199, in find
    raise ValueError('No backend available')
ValueError: No backend available
+3
source share
3 answers

I had the same error but failed to use find_library( TypeError: get_backend() got an unexpected keyword argument 'find_library'). I suppose, although you did not say that, it is backendinvalid ( None).

libusb1 C:\Python27? , Python, , : PyUSB .

, find_library, libusb1, PATH. ( os.getcwd() ):

def get_backend_libusb01():
    libusb01_location = os.getcwd()

    # load-library (ctypes.util.find_library) workaround: also search the current folder
    is_current_folder_in_search_path = True
    if None == usb.backend.libusb0.get_backend():
        is_current_folder_in_search_path = libusb01_location in os.environ['PATH']
        if not is_current_folder_in_search_path:
            os.environ['PATH'] += os.pathsep + libusb01_location

    backend = usb.backend.libusb0.get_backend()

    if not is_current_folder_in_search_path:
        os.environ['PATH'] = os.environ['PATH'].replace(os.pathsep + libusb01_location, "")

    return backend
+2
+1

:  - libusb-win32-devel-filter-1.2.6.0.exe. .

From:

Pyusb -

.

+1

All Articles