<div dir="ltr">Hi Vadim and all,<div><br></div><div>pyProg.py fails with an error, could you help (btw, I change all real info to xxx :)):</div><div><br></div><div>support@S2600WFT:~/pysim$ python ./pySim-prog.py -p 0 -x 208 -y 93 -t sysmoUSIM-SJS1 -i 208930000000003 --op=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -k xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -s xxxxxxxxxxxxxxxxxxxxx -a xxxxxxxx<br>Using PC/SC reader interface<br>Ready for Programming: Insert card now (or CTRL-C to cancel)<br>Generated card parameters :<br> > Name     : Magic<br> > SMSP     : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<br> > ICCID    : xxxxxxxxxxxxxxxxxxxx<br> > MCC/MNC  : 208/93<br> > IMSI     : xxxxxxxxxxxxxxx<br> > Ki       : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <br> > OPC      : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <br> > ACC      : None<br> > ADM1(hex): xxxxxxxxxxxxxxxx<br>Programming ...<br><br>Card programming failed with an execption:<br>---------------------8<---------------------<br>Traceback (most recent call last):<br>  File "./pySim-prog.py", line 719, in <module><br>    rc = process_card(opts, first, card_handler)<br>  File "./pySim-prog.py", line 671, in process_card<br>    card.program(cp)<br>  File "/home/support/pysim/pySim/cards.py", line 713, in program<br>    self._scc.verify_chv(0x0A, h2b(p['pin_adm']))<br>  File "/home/support/pysim/pySim/commands.py", line 206, in verify_chv<br>    return self._tp.send_apdu_checksw(self.cla_byte + '2000' + ('%02X' % chv_no) + '08' + fc)<br>  File "/home/support/pysim/pySim/transport/__init__.py", line 104, in send_apdu_checksw<br>    raise RuntimeError("SW match failed! Expected %s and got %s." % (sw.lower(), rv[1]))<br>RuntimeError: SW match failed! Expected 9000 and got 63c9.<br>---------------------8<---------------------<br><br>Programming failed: Remove card from reader<br></div><div><br></div><div>Thanks.</div><div>Br,</div><div>Andrew</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 1, 2020 at 1:07 AM Chunlin Yang <<a href="mailto:chliny2016@gmail.com">chliny2016@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks a lot Vadim!<div>I have thought it might be an issue between python3 and python2. So I have tried on both versions.</div><div>on Python3, I got same error.</div><div>But now with this command <span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px"> '</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px">python ./pySim-read.py -p0', it works. I used to use this command '</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px">./pySim-read.py -p0' and it gave me the same error.</span></div><div><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px"><br></span></div><div><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px">But although '</span>python ./pySim-read.py -p0' works (reads out the content of the SIM, it gives me an error/prompt at the end: </div><div>Traceback (most recent call last):<br>  File "./pySim-read.py", line 255, in <module><br>    (res, sw) = card.read_ehplmn()<br>AttributeError: 'OpenCellsSim' object has no attribute 'read_ehplmn'<br><br></div><div>maybe I can just ignore this prompt as I don't need ehplmn.</div><div><br></div><div>Br,</div><div>Andrew</div>











</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 1, 2020 at 12:45 AM Vadim Yanitskiy <<a href="mailto:vyanitskiy@sysmocom.de" target="_blank">vyanitskiy@sysmocom.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 12/1/20 2:17 AM, Chunlin Yang wrote:<br>
> ModuleNotFoundError: No module named 'smartcard'<br>
> <br>
> BTW, I have manually imported smartcard in python, and it's successful.<br>
<br>
I guess you have two Python versions (2.7 and 3.x), so it could be that <br>
you've installed smartcard for 3.x and in works in the shell. <br>
Unfortunately, pySim has not been completely migrated to 3.x yet, so it <br>
starts under 2.7 by default.  You can try to run it under 3.x:<br>
<br>
   python3 ./pySim-read.py -p0<br>
<br>
or install the 'smartcard' module for Python 2.7.<br>
<br>
Best regards,<br>
Vadim.<br>
<br>
-- <br>
- Vadim Yanitskiy <vyanitskiy at <a href="http://sysmocom.de" rel="noreferrer" target="_blank">sysmocom.de</a>>    <a href="http://www.sysmocom.de/" rel="noreferrer" target="_blank">http://www.sysmocom.de/</a><br>
=======================================================================<br>
* sysmocom - systems for mobile communications GmbH<br>
* Alt-Moabit 93<br>
* 10559 Berlin, Germany<br>
* Sitz / Registered office: Berlin, HRB 134158 B<br>
* Geschaeftsfuehrer / Managing Director: Harald Welte<br>
</blockquote></div>
</blockquote></div>