File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434from smartcard import System
3535from smartcard .CardConnection import CardConnection
3636from smartcard .pcsc .PCSCExceptions import ListReadersException
37- from smartcard .pcsc .PCSCContext import PCSCContext
3837
3938from threading import Event
4039from typing import Callable , Iterator
@@ -243,9 +242,15 @@ def list_devices(cls, name: str = "") -> Iterator[CtapPcscDevice]:
243242def _list_readers ():
244243 try :
245244 return System .readers ()
246- except ListReadersException :
245+ except ListReadersException as e :
247246 # If the PCSC system has restarted the context might be stale, try
248247 # forcing a new context (This happens on Windows if the last reader is
249248 # removed):
250- PCSCContext .instance = None
251- return System .readers ()
249+ try :
250+ from smartcard .pcsc .PCSCContext import PCSCContext
251+
252+ PCSCContext .instance = None
253+ return System .readers ()
254+ except ImportError :
255+ # As of pyscard 2.2.2 the PCSCContext singleton has been removed
256+ raise e
You can’t perform that action at this time.
0 commit comments