将python第三方库导入Jython时出错

时间:2012-02-23 04:40:16

标签: import module jython smartcard

我尝试将智能卡(从pyscard)导入Jython,但它失败了。我按照建议添加了路径:

>>> sys.path.append("C:\Python26\Lib\site-packages")
>>> sys.path.append("C:\Python26\Dll")
>>> sys.path.append("C:\Python26\lib\lib-tk")
>>> sys.path.append("C:\Python26\lib\plat-win")
>>> print sys.path
['', 'C:\\jython2.5.2\\Lib', '__classpath__', '__pyclasspath__/',     'C:\\jython2.5.2\\Lib\\site-packages', 'C:\\Python26\\Lib\\site-packages', 'C:\\Python26\\Lib', 'C:\\Python26\\Dll', 'C:\\Python26\\lib\\lib-tk', 'C:\\Python26\\lib\\plat-win']
>>> import smartcard
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\Lib\site-packages\smartcard\__init__.py", line 34, in <module>
  from smartcard.System import listReaders
File "C:\Python26\Lib\site-packages\smartcard\System.py", line 27, in <module>
  import smartcard.reader.ReaderFactory
File "C:\Python26\Lib\site-packages\smartcard\reader\ReaderFactory.py", line 34, in   <module>
  from smartcard.pcsc.PCSCReader import PCSCReader
File "C:\Python26\Lib\site-packages\smartcard\pcsc\PCSCReader.py", line 27, in <module>
  from smartcard.pcsc.PCSCContext import PCSCContext
File "C:\Python26\Lib\site-packages\smartcard\pcsc\PCSCContext.py", line 27, in <module>
  from smartcard.scard import *
File "C:\Python26\Lib\site-packages\smartcard\scard\__init__.py", line 4, in <module>
  from smartcard.scard._scard import *
ImportError: No module named _scard

然而在我的python中它工作正常。有人对此提出建议吗?

由于

1 个答案:

答案 0 :(得分:1)

您可以在Jython中使用javax.smartcardio来访问智能卡。无法导入pyscard。