Yubico / yubikey-manager-qt

Cross-platform application for configuring any YubiKey over all USB interfaces.
https://developers.yubico.com/yubikey-manager-qt/
BSD 2-Clause "Simplified" License
238 stars 29 forks source link

'NoneType' object does not support the context manager protocol when clicking on PIV #367

Open dlazerka opened 2 weeks ago

dlazerka commented 2 weeks ago

Steps to reproduce

  1. Run the .AppImage (device recognized correctly).
  2. Click Applications menu.
  3. Click bottom menu item "PIV"

Expected result

No error

Actual results

Qt Quick Layouts: Polish loop detected. Aborting after two iterations.
Qt Quick Layouts: Polish loop detected. Aborting after two iterations.
Failed to open device
Traceback (most recent call last):
  File "qrc:///py/yubikey.py", line 78, in wrapped
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "qrc:///py/yubikey.py", line 300, in refresh_piv
    with self._open_device([SmartCardConnection]) as conn:
TypeError: 'NoneType' object does not support the context manager protocol

And red error message in GUI.

Other info

If trying to run from root user, and performing the same steps, the error logs are somewhat different:

[sudo] password for user:             
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Failed to open device
Traceback (most recent call last):
  File "qrc:///py/yubikey.py", line 78, in wrapped
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "qrc:///py/yubikey.py", line 300, in refresh_piv
    with self._open_device([SmartCardConnection]) as conn:
TypeError: 'NoneType' object does not support the context manager protocol
qml: qrc:/qml/PivView.qml:26: Error: Invalid write to global property "isMacOs"