pywinusb
pywinusb copied to clipboard
core.py collections callable error
Hi,
I tried the example show_hids.py from this repo and this error occurs:
..Project\venv\Lib\site-packages\pywinusb\hid\core.py", line 1567, in inspect if isinstance(value, collections.Callable): ^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'collections' has no attribute 'Callable'
Specs:
- pywinusb 0.4.2
- Win11
- Python Version: 3.11.4
- IDE: PyCharm 2023.2.3 Com.Ed.
- Script runs with venv (by default from PyCharm)
Note: Googl`d error background: This error occurs in other contexts, too. Mostly when older packages are being used in combination with modern python versions. So I think i found a fix and I thought about sharing it if you want to include it in a future version.
The Fix:
File: core.py Action:
- Replace line 14 from
import collections
toimport _collections_abc
- Replace line 1567 from
if isinstance(value, collection.Callable):
toif isinstance(value, _collections_abc.Callable)
.
New behavior:
No error message and a long print of HID information.