I am trying to figure out an issue with USB redirection for a smartcard device within a VDI solution. I am using the pyscard module for the smartcard. For further context, main issue is the card reader is not detected when the browser plugin calls the python script used to handle the smartcard.
On to the question, when I run this code snippet from the CMD interpreter, I receive back any empty list, indicating a device was not found on the system
CMD:
import smartcard.System print(smartcard.System.readers())
which returns
[]
IDLE:
However, when I run the same code from IDLE it does return the device, indicating it can detect it which is the desired state
import smartcard.System print(smartcard.System.readers())
returns a list with one entry, the name of the smart card reader (simplified with a placeholder below as device name is irrelevant).
['device name']
Why would IDLE be able to detect the device while the python interpreter through CMD cannot? Operating system is Windows Server 2022.
I have tried setting the PYTHONHOME environment variable as well as printing the environment variables in both IDLE and the interpreter to make sure they are using the same path. IDLE has more path’s shown, but both IDLE and interpreter point to the same python directory.
Additionally, checked the version of Python both IDLE and interpreter are using, confirming both environments are using the same version of Python, Python3.11.9.