Yubico / python-yubico

Python code to talk to YubiKeys
https://developers.yubico.com/python-yubico/
BSD 2-Clause "Simplified" License
229 stars 33 forks source link

Inventory Example Fails with NoneType object error #37

Closed steveno closed 5 years ago

steveno commented 7 years ago
YubiKeyHIDDevice: detachKernelDriver not supported!
YubiKeyHIDDevice: Unable to set configuration, ignoring...
YubiKeyHIDDevice: READ  : 0000   00 04 03 03 03 07 02 00
YubiKeyHIDDevice: READ  : 0000   00 04 03 03 03 07 02 00
YubiKeyHIDDevice: READ  : 0000   00 04 03 03 03 07 02 00
YubiKeyHIDDevice: WRITE : 0000   00 00 00 00 00 00 00 80 
YubiKeyHIDDevice: READ  : 0000   00 04 03 03 03 07 02 00
YubiKeyHIDDevice: WRITE : 0000   00 13 6b 5b 00 00 00 89 
YubiKeyHIDDevice: READ  : 0000   0c 01 01 3f 02 04 00 c0
YubiKeyHIDDevice: READ  : 0000   52 c6 17 03 01 3f 7c c1
YubiKeyHIDDevice: READ  : 0000   e9 6d 67 46 00 26 67 c2
YubiKeyHIDDevice: READ  : 0000   0c 01 01 3f 02 04 00 c0
YubiKeyHIDDevice: WRITE : 0000   00 00 00 00 00 00 00 8f 
YubiKeyHIDDevice: READ  : 0000   00 04 03 03 03 07 02 00
[<YubiKey4_USBHID instance at 0x7f1bb1105710: YubiKey version 4.3.3>]
Exception ignored in: <bound method YubiKeyHIDDevice.__del__ of <yubico.yubikey_usb_hid.YubiKeyHIDDevice object at 0x7f1bb392ce48>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/python_yubico-1.3.2-py3.5.egg/yubico/yubikey_usb_hid.py", line 138, in __del__
  File "/usr/local/lib/python3.5/dist-packages/python_yubico-1.3.2-py3.5.egg/yubico/yubikey_usb_hid.py", line 345, in _close
  File "/usr/local/lib/python3.5/dist-packages/usb/legacy.py", line 235, in releaseInterface
  File "/usr/local/lib/python3.5/dist-packages/usb/util.py", line 217, in release_interface
AttributeError: 'NoneType' object has no attribute '_ctx'
steveno commented 7 years ago

Ubuntu 16.04.2 Python 3.5.2 python-yubico from git master

mdxs commented 5 years ago

I actually also observed the '_ctx' at one point in time; and I recall that it occurred when I was using the official python-yubico from PyPi on Python 3. Note however that https://github.com/Yubico/python-yubico/issues/38 identifies that the PyPi release is not up to date and has other issues.

Now @steveno reported above that it was installed from git master at the time (on 20 Feb 2017). However, there have been several commits afterwards; and the pyusb dependency has also gone forward.

dainnilsson commented 5 years ago

This should be resolved in 1.3.3