apmorton / pyhidapi

hidapi bindings in ctypes
MIT License
111 stars 42 forks source link

Improve import errors #13

Closed 3demax closed 5 years ago

3demax commented 7 years ago

Hello, apmorton!

Recently I tried to import hid library version 0.1.1, installed with pip.
The problem is that in docker container with ubuntu, trying to import it in the code raises following exception: hidapi = ctypes.windll.LoadLibrary('hidapi.dll') AttributeError: 'module' object has no attribute 'windll'

After digging I have found that the problem was missing libraries.
If anyone will ever happen to encounter this bug again, missing libraries can be installed in Ubuntu with sudo apt-get install libhidapi-hidraw0 libusb-1.0-0.dev libudev-dev -y

Anyway, I still think that exception can be much clearer about this, by listing library names it was trying to find.