LudovicRousseau / pyscard

pyscard smartcard library for python
http://pyscard.sourceforge.net/
GNU Lesser General Public License v2.1
379 stars 108 forks source link

plugout the smartcard device raise an error SCARD_E_NO_SERVICE #87

Closed leileigong closed 4 years ago

leileigong commented 4 years ago

pyscard 1.9.8

Traceback (most recent call last): File "E:\FNTools\smartcard\CardMonitoring.py", line 162, in run currentcards = self.cardrequest.waitforcardevent() File "E:\FNTools\smartcard\CardRequest.py", line 73, in waitforcardevent return self.pcsccardrequest.waitforcardevent() File "E:\FNTools\smartcard\pcsc\PCSCCardRequest.py", line 305, in waitforcardevent readernames = self.getReaderNames() File "E:\FNTools\smartcard\pcsc\PCSCCardRequest.py", line 103, in getReaderNames raise ListReadersException(hresult) smartcard.Exceptions.ListReadersException: ('Failed to list readers', -2146435043)

LudovicRousseau commented 4 years ago

Yes, it is the "expected" behaviour on Windows. See also https://github.com/LudovicRousseau/pyscard/issues/74

You should report the problem to Microsoft.

kurenai-ryu commented 4 years ago

You can release the context before trying to list the readers