Menu

#4 Error on SCardEstablishContext

v1.0 (example)
closed
None
5
2015-08-15
2015-07-14
No

Hello, I'm trying to use pyscard by running some code samples, but right at the beggining, when trying to establish a context, the program crashes due an unidentified error code, as showed below.

Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> from smartcard.scard import *
>>> hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
>>> hresult
-855572480L
>>> hex(hresult)
'-0x32ff0000L'
>>>

I don't know what the problem might be, since the value of hresult is not a listed SCARDRETCODE.
It would be of great help if somebody could look into it.

Best Regards,
Emiliano Leite.

Discussion

  • Ludovic Rousseau

    It looks like -855572480L is a Windows specific error code. I have no idea what it is.

    I could find it also in http://bytes.com/topic/visual-basic-net/answers/385725-smartcard

    What version of pyscard do you use?
    Where did you got it?

     
  • Emiliano Leite

    Emiliano Leite - 2015-08-06

    I'm using pyscard-1.7.0, which I downloaded here at sourceforge.

    I don't believe there's a problem with my SCARDLIBlib dll(as mentioned in http://bytes.com/topic/visual-basic-net/answers/385725-smartcard) for I already have functioning scard libs in java and c++ here in my machine, but I could be wrong.

    I'm really sorry about the duplicated tickets.

    Cheers.
    -Emiliano.

     
  • Emiliano Leite

    Emiliano Leite - 2015-08-06

    I just now tried to install pyscard-1.7.0 on a 64bit machine, and it worked perfectly.

     
  • Ludovic Rousseau

    Did you used the 32-bits version on the 32-bits Windows?

     
  • Emiliano Leite

    Emiliano Leite - 2015-08-07

    Yes, I did.

     
  • Ludovic Rousseau

    I do not use Windows myself.
    Maybe the Windows binary provided at sourceforge is wrong. You can try to rebuild it yourself.

     
  • Emiliano Leite

    Emiliano Leite - 2015-08-07

    I don't know what you mean by "rebuild it", but I already tried installing the lib using the binaries and the 'installer', both to no avail.

     
  • Ludovic Rousseau

    "rebuild" is:

    1. get the source code
    2. build it
    3. install it

    Something like:

     git clone https://git.code.sf.net/p/pyscard/Git pyscard
     cd pyscard
     python setup build
     python setup install
    
     
  • Emiliano Leite

    Emiliano Leite - 2015-08-10

    Just did it. Unfortunately it didn't work.

     
  • Emiliano Leite

    Emiliano Leite - 2015-08-14

    Installing pyscard-1.9.0 (on Python 2.7.10) fixed the problem.

     
  • Ludovic Rousseau

    OK. Closing the bug report.

     
  • Ludovic Rousseau

    • status: open --> closed
     

Log in to post a comment.