JPEWdev / pyhid-usb-relay

Python script for controlling dcttech USB HID relay modules
MIT License
22 stars 8 forks source link

NoBackendError python 3.8 in win 10 x64 #3

Closed KEHT067 closed 2 years ago

KEHT067 commented 2 years ago

Hello! I am have hw-348 usb relay (USB\VID_16C0&PID_05DF&REV_0100) I am runing example code with python 3.8 in win 10 x64, and answer is: Traceback (most recent call last): File "D:\Desktop\Py\USBHidWatchdog/USB_HID_WATCHDOG.py", line 3, in relay = pyhid_usb_relay.find() File "D:\Desktop\Py\USBHidWatchdog\lib\site-packages\pyhid_usb_relay\find.py", line 39, in find devices = usb.core.find( File "D:\Desktop\Py\USBHidWatchdog\lib\site-packages\usb\core.py", line 1309, in find raise NoBackendError('No backend available') usb.core.NoBackendError: No backend available

But with windows app usb-relay-hid relay is working.

Please help me

Thank you

KEHT067 commented 2 years ago

I fix it bug with libusb dlls 1.0.26 (https://github.com/libusb/libusb) and change hid driver with zadig 2.7 (https://zadig.akeo.ie) to winusb driver.

Zadig

libusb-1.0.dll x32 put in Windows/SysWOW64 and libusb-1.0.dll x64 put in Windows/System32 (need VS2015)

But after pyinstaller program not working: Fix (found on https://github.com/pyinstaller/pyinstaller/issues/1891)

Compilating pyinstaller with .spec file, in .spec file: binaries = [ ('C:\Windows\System32\libusb-1.0.dll', '.'), ]

a = Analysis(['myscript.py'], ... binaries=binaries, datas=[], hiddenimports=['usb'],
...