5

On windows 8.1, Python 2.7, pyscard(latest) i list readers from my software like so:

for reader in readers():
        print "list of readers:"
        print readers
        try:
            conn = reader.createConnection()
            conn.connect()

            data, status = _cmd2(conn, 0, 0xa4, 0x04, 0x00, 'appletID'.decode('hex'))

Now, when i remove the smart card and plug it back in and try to open the connection again with the same software (i didnt closed the software meanwhile) i get this error:

> 'Failure to list readers: The Smart Card Resource Manager has shut
> down. '

If instead I close the software and re-list readers and open the connection everything works fine.

Apparently Windows does something if the smart-card is removed and re-inserted that prevents to establish a new connection.

Anyone can show me the way of the Ninja? Thank you.

NoobTom
  • 555
  • 1
  • 9
  • 21

1 Answers1

1

In PySCard 2.0.3 (March 2022) I fixed a problem that the PC/SC resource manager was shutdown by Windows when the last reader (not smart card) is removed.

You may want to try a newer version of PySCard.