facing thise error when am trying to run the Read.py
below is the stack trace for the error am facing when am trying to run the Read.py script..
Traceback (most recent call last):
File "Read.py", line 41, in
I'm facing same issue with python 2.713
Hi, Have you tried with 3.5!
Yes, it's seems that it's not compatible with python3 as it require parenthesis for printcommand.
you can add parenthesis for all prints and try run.. i just tried on 2.7 as well same error for me.. am stuck here at this part
i hope it is not hardware problem. coz mine is new
The hardware is working. I have the problem after reinstalling raspbian.
@te-ti oh you were able to run it previously?
I've figure out the problem I guess. I think it come from https://github.com/lthiery/SPI-Py library.
did you find anything? please share thanks if is working for you
this is the snapshot of the locals when am trying to debug

same problem here it seems there are some problems with the recent updates from SPI-Py
If you "rollback" SPI-Py to commit before February 17th, it should work.
git clone https://github.com/lthiery/SPI-Py.git
git checkout 8cce26b9ee6e69eb041e9d5665944b88688fca68
sudo python setup.py install
Error is fixed but my tag not detected..
Same, I don't understand why.
@te-ti emmm...I just want know have you fixed the problem? Change another one?Or fix the code? It's very important to me. Thank you very much!
let me know if this works anyone.. thanks
If you "rollback" SPI-Py to commit before February 17th, it should work.
git clone https://github.com/lthiery/SPI-Py.git git checkout 8cce26b9ee6e69eb041e9d5665944b88688fca68 sudo python setup.py install
atlast working for me.. i have soldered the reader pins then it works..
@sandeeppusthey Still not working for me... Can you post a picture of how you wire the pins from rfid reader to the pi board?
the pins must be tightly fixed into the board..
Hi all, i stumbled on this as well on a RPI 3 B+ and Raspian Strech. First i changed GPIO 22 to 11, because of this comment "SPI_CLK on a RPi 3 is Pin number 23 = GPIO11 (not 22)" in https://www.raspberrypi.org/forums/viewtopic.php?t=147291 Then i got this error. Not much of a python pro, but figured it out by looking in the SPI test_script: https://github.com/lthiery/SPI-Py/blob/master/test_script.py The changed function spi.transfer wants the file descriptor from spi.openSPI. I saved it in a global var and added it where needed. So, by making these changes to MFRC522.py, it will run again with latest SPI. After downloading this file, rename to MFRC522.py, then overwrite your file in cloned git. With git diff MFRC522.py you can see the changes made.
I u are not on a RPi 3, change the line NRSTPD = 11 back to 22 :-)
@abrakhim Cool!It works!Oh ,mine is Raspberry 2B.So not the pin problem.
Thank you very much!
@te-ti And I'm was not forget your advise!Without your's I cannot fix it so quickly!
英语很差,用中文回答吧.因为新提交的SPI-Py中,spi.transfer需要两个参数,在MFRC522.py中定义device_0=spi.openSPI(device="/dev/spidev0.0", mode=0, speed=1000000),修改 spi.transfer( ((addr<<1)&0x7E,val))和val = spi.transfer((((addr<<1)&0x7E) | 0x80,0))为spi.transfer(self.device_0, ((addr<<1)&0x7E,val))和val = spi.transfer(self.device_0, (((addr<<1)&0x7E) | 0x80,0))即可.
If you "rollback" SPI-Py to commit before February 17th, it should work.
git clone https://github.com/lthiery/SPI-Py.git git checkout 8cce26b9ee6e69eb041e9d5665944b88688fca68 sudo python setup.py installatlast working for me.. i have soldered the reader pins then it work
@te-ti i tried this : git clone https://github.com/lthiery/SPI-Py.git git checkout 8cce26b9ee6e69eb041e9d5665944b88688fca68 sudo python setup.py install
after git checkout .... i got this: fatal: Not a git repository (or any of the parent directories): .git what have i done wrong?
If you "rollback" SPI-Py to commit before February 17th, it should work.
git clone https://github.com/lthiery/SPI-Py.git git checkout 8cce26b9ee6e69eb041e9d5665944b88688fca68 sudo python setup.py installatlast working for me.. i have soldered the reader pins then it work
@te-ti i tried this : git clone https://github.com/lthiery/SPI-Py.git git checkout 8cce26b9ee6e69eb041e9d5665944b88688fca68 sudo python setup.py install
after git checkout .... i got this: fatal: Not a git repository (or any of the parent directories): .git what have i done wrong?
Have you "cd" into the "SPI-Py" directory before running git checkout?
just copy the MFRC522.py from the following project and it works. git clone https://github.com/pimylifeup/MFRC522-python.git
@MatsCedergren Yes i did, still the same: pi@raspberrypi:~ $ git checkout 8cce26b9ee6e69eb041e9d5665944b88688fca68 fatal: Not a git repository (or any of the parent directories): .git
me, I don't understand wh
it is the issue of [ spi.transfer() ],it need two arguments and the MFRC522.py file just one given!
it need install python2?
I can now detect card on Read.py. My problem was that I use python3 on Raspberry Pi3. I do some change:
- after downloaded, sudo python3 setup.py install on /SPI-py (latest version)
- Then i've changed all print in MFRC522.py like this print "test" -> print("test")
- The NRSTPD is set to 11 in MFRC522.py
I've could resolve the issue after using older branch. First you clone it after that you enter into the recently created folder. and after that you execute this: git clone https://github.com/lthiery/SPI-Py.git git checkout -b 8cce26b9ee6e69eb041e9d5665944b88688fca68 sudo python setup.py install
this worked as a charm for me hopefully it helps others. Thank you.