Menu

#7 ImportError: No module named 'smartcard.scard.scard'

v1.0 (example)
closed
None
5
2016-09-10
2016-03-04
No

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

Discussion

  • Jean-Noel Colin

    Jean-Noel Colin - 2016-03-04

    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.

    from smartcard.ATR import ATR
    Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/smartcard/scard/scard.py", line 119, in swig_import_helper
    fp, pathname, description = imp.find_module('_scard', [dirname(file)])
    File "/usr/lib/python3.4/imp.py", line 297, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
    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'

    from smartcard.System import readers
    Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/smartcard/scard/scard.py", line 119, in swig_import_helper
    fp, pathname, description = imp.find_module('_scard', [dirname(file)])
    File "/usr/lib/python3.4/imp.py", line 297, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
    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'

     
    • Ludovic Rousseau

      I have no solution now.
      A fix is greatly welcomed :-)

       
  • Jean-Noel Colin

    Jean-Noel Colin - 2016-03-04

    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

     
  • Ludovic Rousseau

    • status: open --> closed
    • assigned_to: Ludovic Rousseau
     
  • Ludovic Rousseau

    This problem should be fixed with version 1.9.4.

     

Log in to post a comment.