def __init__(self, reader): """Construct a new PCSC card connection. reader: the reader in which the smartcard to connect to is located. """ CardConnection.__init__(self, reader) self.hcard = None hresult, self.hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if hresult != 0: raise CardConnectionException('Failed to establish context : ' + SCardGetErrorMessage(hresult))