check pyscard module first

This commit is contained in:
merlokk 2019-06-28 12:32:52 +03:00
parent 751b2fd69c
commit 2c500fe25a

View File

@ -1,4 +1,4 @@
import time, struct import time, struct, sys
from fido2.hid import CtapHidDevice from fido2.hid import CtapHidDevice
from fido2.client import Fido2Client from fido2.client import Fido2Client
@ -68,6 +68,8 @@ class Tester:
dev = next(CtapHidDevice.list_devices(), None) dev = next(CtapHidDevice.list_devices(), None)
if not dev: if not dev:
try: try:
if 'pyscard' not in sys.modules:
print('You have not installed pyscard module')
from fido2.nfc import CtapNfcDevice from fido2.nfc import CtapNfcDevice
print("--- NFC ---") print("--- NFC ---")
print(list(CtapNfcDevice.list_devices())) print(list(CtapNfcDevice.list_devices()))