"EstablishContextException" Python 中的错误
"EstablishContextException" error in Python
我已经下载 Python-2.7 和 pyscard-1.7.0.win32-py2.7 并安装他们在我的电脑上使用我的 ACR122U 智能卡 reader 在我的 Windows-7.
之后我写了下面的程序:
import sys
import time
sys.path.append("C:\Python27\Lib\site-packages")
from smartcard.scard import *
import smartcard.util
from smartcard.System import readers
class Metro:
isConnected = False
isLoaded = False
isAuthenticated = False
.
. # Methods censored.
.
当我想要 运行 程序时,我收到这些错误:
Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
>>> Connecting to the reader:
Traceback (most recent call last):
File "C:\Users\AmirEbrahim\Desktop\metro.py", line 195, in <module>
m.connect()
File "C:\Users\AmirEbrahim\Desktop\metro.py", line 63, in connect
r = readers()
File "C:\Python27\lib\site-packages\smartcard\System.py", line 41, in readers
return smartcard.reader.ReaderFactory.ReaderFactory.readers(groups)
File "C:\Python27\lib\site-packages\smartcard\reader\ReaderFactory.py", line 58, in readers
zreaders += fm(groups)
File "C:\Python27\lib\site-packages\smartcard\pcsc\PCSCReader.py", line 107, in readers
hcontext = PCSCContext().getContext()
File "C:\Python27\lib\site-packages\smartcard\pcsc\PCSCContext.py", line 53, in __init__
PCSCContext.instance = PCSCContext.__PCSCContextSingleton()
File "C:\Python27\lib\site-packages\smartcard\pcsc\PCSCContext.py", line 40, in __init__
raise EstablishContextException(hresult)
EstablishContextException: <unprintable EstablishContextException object>
>>>
怎么了?
我从 here 下载并安装了旧版本的 PyScard,现在它运行良好。
我已经下载 Python-2.7 和 pyscard-1.7.0.win32-py2.7 并安装他们在我的电脑上使用我的 ACR122U 智能卡 reader 在我的 Windows-7.
之后我写了下面的程序:
import sys
import time
sys.path.append("C:\Python27\Lib\site-packages")
from smartcard.scard import *
import smartcard.util
from smartcard.System import readers
class Metro:
isConnected = False
isLoaded = False
isAuthenticated = False
.
. # Methods censored.
.
当我想要 运行 程序时,我收到这些错误:
Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
>>> Connecting to the reader:
Traceback (most recent call last):
File "C:\Users\AmirEbrahim\Desktop\metro.py", line 195, in <module>
m.connect()
File "C:\Users\AmirEbrahim\Desktop\metro.py", line 63, in connect
r = readers()
File "C:\Python27\lib\site-packages\smartcard\System.py", line 41, in readers
return smartcard.reader.ReaderFactory.ReaderFactory.readers(groups)
File "C:\Python27\lib\site-packages\smartcard\reader\ReaderFactory.py", line 58, in readers
zreaders += fm(groups)
File "C:\Python27\lib\site-packages\smartcard\pcsc\PCSCReader.py", line 107, in readers
hcontext = PCSCContext().getContext()
File "C:\Python27\lib\site-packages\smartcard\pcsc\PCSCContext.py", line 53, in __init__
PCSCContext.instance = PCSCContext.__PCSCContextSingleton()
File "C:\Python27\lib\site-packages\smartcard\pcsc\PCSCContext.py", line 40, in __init__
raise EstablishContextException(hresult)
EstablishContextException: <unprintable EstablishContextException object>
>>>
怎么了?
我从 here 下载并安装了旧版本的 PyScard,现在它运行良好。