Page 1 of 1

[SOLVED] Cannot run Python examples on Windows 10 -> libusb0-dll:err

Posted: Tue Feb 12, 2019 3:25 pm
by salocinx
Hi. I am trying to run the Python examples (i.e. basiclog.py and ramp.py) on Windows 10. Here's my system configuration and what I have installed so far:

1.) Running Windows 10 x64 with Python 2.7.15 installed to C:/Python27
2.) Downloaded the crazyflie-lib-python project from https://github.com/bitcraze/crazyflie-lib-python
3.) Followed the instructions from the README (pip install / pip install -r requirements.txt / etc.)
4.) Installed libusb-win32 (v1.2.6.0) via zadig.exe in Administrator mode

The installation process worked without any errors. I am able to control my CrazyFlies 2.0 with the pre-built PC Client software. So basically everything seems to run fine, except the Python examples.

Here's the error message I get when trying to run examples/basiclog.py for example:
E:\Projekte\_Abraham\crazyflie\workspace\crazyflie-lib-python>python examples/basiclog.py
Scanning interfaces for Crazyflies...
Crazyflies found:
radio://0/80/2M
Connecting to radio://0/80/2M
ERROR:cflib.crazyflie:Couldn't load link driver: [Errno None] libusb0-dll:err [set_configuration] could not set config 1: win error: The parameter is incorrect.


Traceback (most recent call last):
File "e:\projekte\_abraham\crazyflie\workspace\crazyflie-lib-python\cflib\crazyflie\__init__.py", line 223, in open_link
link_uri, self._link_quality_cb, self._link_error_cb)
File "e:\projekte\_abraham\crazyflie\workspace\crazyflie-lib-python\cflib\crtp\__init__.py", line 91, in get_link_driver
instance.connect(uri, link_quality_callback, link_error_callback)
File "e:\projekte\_abraham\crazyflie\workspace\crazyflie-lib-python\cflib\crtp\radiodriver.py", line 191, in connect
address)
File "e:\projekte\_abraham\crazyflie\workspace\crazyflie-lib-python\cflib\crtp\radiodriver.py", line 101, in __init__
_RadioManager._radios[self._devid] = _SharedRadio(self._devid)
File "e:\projekte\_abraham\crazyflie\workspace\crazyflie-lib-python\cflib\crtp\radiodriver.py", line 70, in __init__
self.radio = Crazyradio(devid=devid)
File "e:\projekte\_abraham\crazyflie\workspace\crazyflie-lib-python\cflib\drivers\crazyradio.py", line 126, in __init__
self.dev.set_configuration(1)
File "C:\Python27\lib\site-packages\usb\core.py", line 799, in set_configuration
self._ctx.managed_set_configuration(self, configuration)
File "C:\Python27\lib\site-packages\usb\core.py", line 128, in managed_set_configuration
self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
File "C:\Python27\lib\site-packages\usb\backend\libusb0.py", line 439, in set_configuration
_check(_lib.usb_set_configuration(dev_handle, config_value))
File "C:\Python27\lib\site-packages\usb\backend\libusb0.py", line 380, in _check
raise USBError(errmsg, ret)
USBError: [Errno None] libusb0-dll:err [set_configuration] could not set config 1: win error: The parameter is incorrect.


Connection to radio://0/80/2M failed: Couldn't load link driver: [Errno None] libusb0-dll:err [set_configuration] could not set config 1: win error: The parameter is incorrect.


Traceback (most recent call last):
File "e:\projekte\_abraham\crazyflie\workspace\crazyflie-lib-python\cflib\crazyflie\__init__.py", line 223, in open_link
link_uri, self._link_quality_cb, self._link_error_cb)
File "e:\projekte\_abraham\crazyflie\workspace\crazyflie-lib-python\cflib\crtp\__init__.py", line 91, in get_link_driver
instance.connect(uri, link_quality_callback, link_error_callback)
File "e:\projekte\_abraham\crazyflie\workspace\crazyflie-lib-python\cflib\crtp\radiodriver.py", line 191, in connect
address)
File "e:\projekte\_abraham\crazyflie\workspace\crazyflie-lib-python\cflib\crtp\radiodriver.py", line 101, in __init__
_RadioManager._radios[self._devid] = _SharedRadio(self._devid)
File "e:\projekte\_abraham\crazyflie\workspace\crazyflie-lib-python\cflib\crtp\radiodriver.py", line 70, in __init__
self.radio = Crazyradio(devid=devid)
File "e:\projekte\_abraham\crazyflie\workspace\crazyflie-lib-python\cflib\drivers\crazyradio.py", line 126, in __init__
self.dev.set_configuration(1)
File "C:\Python27\lib\site-packages\usb\core.py", line 799, in set_configuration
self._ctx.managed_set_configuration(self, configuration)
File "C:\Python27\lib\site-packages\usb\core.py", line 128, in managed_set_configuration
self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
File "C:\Python27\lib\site-packages\usb\backend\libusb0.py", line 439, in set_configuration
_check(_lib.usb_set_configuration(dev_handle, config_value))
File "C:\Python27\lib\site-packages\usb\backend\libusb0.py", line 380, in _check
raise USBError(errmsg, ret)
USBError: [Errno None] libusb0-dll:err [set_configuration] could not set config 1: win error: The parameter is incorrect.
I also tried to switch to libusbK (v3.0.7.0) via zadig.exe. But when doing this, neither the PC Client nor the Python scripts work.

Some ideas what could get me a step further?

Re: Cannot run Python examples on Windows 10 -> libusb0-dll:err

Posted: Thu Feb 14, 2019 10:31 am
by tobias
It sounds like it is a version problem with py-usb, however that should be included in the pip package so don't really know why it fails. I think the libusb0-dll is installed by zadig so could be that as well. Can you try installing python 3 instead and redoing it, possibly that could fix it.

Re: Cannot run Python examples on Windows 10 -> libusb0-dll:err

Posted: Fri Feb 22, 2019 9:45 pm
by salocinx
@tobias: thanks for your support. it's now working fine with Python 2.7.15 and Python 3.7.2. I switched to libusbK (v3.0.7.0) together with Python 2.7.15 which worked for me. Today I tried your suggestion and installed Python 3.7.2 and re-installed cf-lib. It's now also working fine with libusb-win32 (v1.2.6.0).