Skip to content

Commit

Permalink
Handle no backend exception: write warning
Browse files Browse the repository at this point in the history
  • Loading branch information
szszszsz committed Jul 28, 2020
1 parent 5b4022e commit 7fd8d3c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pynitrokey/start/gnuk_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,13 @@ def gnuk_devices():


def gnuk_devices_by_vidpid():
busses = usb.busses()
try:
busses = usb.busses()
except usb.core.NoBackendError:
print("Warning: no backend was found to use for communication. "
"Please refer to documentation how to install additional libraries.")
return []

for bus in busses:
devices = bus.devices
for dev in devices:
Expand Down

0 comments on commit 7fd8d3c

Please sign in to comment.