Closed James-E-A closed 6 months ago
_Describe what you expected should happen._
I should have got a CardRequestTimeoutException when the card wasn't found.
CardRequestTimeoutException
Describe what *did* happen.
I got a TypeError exception when the card wasn't found.
TypeError
Traceback (most recent call last): File "…\test007.py", line 15, in <module> crd = req.waitforcard() File "…\.venv\Lib\site-packages\smartcard\CardRequest.py", line 68, in waitforcard return self.pcsccardrequest.waitforcard() File "…\.venv\Lib\site-packages\smartcard\pcsc\PCSCCardRequest.py", line 216, in waitforcard raise CardRequestTimeoutException(hresult=hresult) TypeError: CardRequestTimeoutException.__init__() got an unexpected keyword argument 'hresult'
Run this code:
import smartcard # https://pypi.org/project/pyscard/ import smartcard.CardRequest import smartcard.CardType class MyCardType(smartcard.CardType.CardType): @classmethod def matches(cls, atr, reader=None): return bytes(atr).startswith(cls.prefix) prefix = b'\x3b\xff\x13\x00\x00' req = smartcard.CardRequest.CardRequest(cardType=MyCardType) crd = req.waitforcard() con = crd.connection con.connect() print('ATR:', bytes(con.getATR()).hex())
Thanks
Your system information
Please describe your issue in as much detail as possible:
_Describe what you expected should happen._
I should have got a
CardRequestTimeoutException
when the card wasn't found.Describe what *did* happen.
I got a
TypeError
exception when the card wasn't found.Steps for reproducing this issue:
Run this code: