I am running Python 3.4 on Ubuntu 15.10
I have installed pyscard 1.9.2 with
pip3 install pyscard
However, when I try to create an example, simply running
from smartcard.scard import *
in the interpreter triggers an error:
ImportError: No module named 'smartcard.scard.scard'
What am I missing?
Thanks for your help
Hello,
There is a problem when PySCard is installed using pip.
See also https://github.com/LudovicRousseau/pyscard/issues/15
I would recommand you to install the Ubuntu package if possible http://packages.ubuntu.com/xenial/python3-pyscard
Hi,
I did as suggested, but now, I get another (yet similar) error:
^Cjnc@enigma:~$ python3
Python 3.4.3+ (default, Oct 14 2015, 16:03:50)
[GCC 5.2.1 20151010] on linux
Type "help", "copyright", "credits" or "license" for more information.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/smartcard/init.py", line 32, in <module>
from smartcard.System import listReaders
File "/usr/lib/python3/dist-packages/smartcard/System.py", line 28, in <module>
import smartcard.reader.ReaderFactory
File "/usr/lib/python3/dist-packages/smartcard/reader/ReaderFactory.py", line 34, in <module>
from smartcard.pcsc.PCSCReader import PCSCReader
File "/usr/lib/python3/dist-packages/smartcard/pcsc/PCSCReader.py", line 28, in <module>
from smartcard.pcsc.PCSCContext import PCSCContext
File "/usr/lib/python3/dist-packages/smartcard/pcsc/PCSCContext.py", line 27, in <module>
from smartcard.scard import
File "/usr/lib/python3/dist-packages/smartcard/scard/init.py", line 1, in <module>
from smartcard.scard.scard import
File "/usr/lib/python3/dist-packages/smartcard/scard/scard.py", line 129, in <module>
_scard = swig_import_helper()
File "/usr/lib/python3/dist-packages/smartcard/scard/scard.py", line 121, in swig_import_helper
import _scard
ImportError: No module named '_scard'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/smartcard/init.py", line 32, in <module>
from smartcard.System import listReaders
File "/usr/lib/python3/dist-packages/smartcard/System.py", line 28, in <module>
import smartcard.reader.ReaderFactory
File "/usr/lib/python3/dist-packages/smartcard/reader/ReaderFactory.py", line 34, in <module>
from smartcard.pcsc.PCSCReader import PCSCReader
File "/usr/lib/python3/dist-packages/smartcard/pcsc/PCSCReader.py", line 28, in <module>
from smartcard.pcsc.PCSCContext import PCSCContext
File "/usr/lib/python3/dist-packages/smartcard/pcsc/PCSCContext.py", line 27, in <module>
from smartcard.scard import
File "/usr/lib/python3/dist-packages/smartcard/scard/init.py", line 1, in <module>
from smartcard.scard.scard import
File "/usr/lib/python3/dist-packages/smartcard/scard/scard.py", line 129, in <module>
_scard = swig_import_helper()
File "/usr/lib/python3/dist-packages/smartcard/scard/scard.py", line 121, in swig_import_helper
import _scard
ImportError: No module named '_scard'
I have no solution now.
A fix is greatly welcomed :-)
I managed to get it to work by removing everything installed with pip3 and with apt-get, downloading the source code and building it with:
sudo python3 setup.py clean build_ext install
This problem should be fixed with version 1.9.4.