2

I am using RFID reader module (MFRC522) with my raspberry pi and when I run the script with python 2 it works fine and reads the RFID tag but when I run it with python3 I get an error - No Module named 'spi'

My script is -

import RPi.GPIO as GPIO
import SimpleMFRC522
reader = SimpleMFRC522.SimpleMFRC522()
try:
        id,text = reader.read()
        print(text)
finally:
        GPIO.cleanup()

I need this to run with python3 because I am using Firebase in my project and it works with python3, not python2.7

2
  • 1
    have you tried installing SPI? pip3 install spi? Apr 2, 2019 at 7:49
  • Or you forgot the statement "import spidev".
    – tlfong01
    Apr 2, 2019 at 8:03

1 Answer 1

1

Turns out that the official package for the MFRC522 module was written in python2 and hence causing the issue. I found an updated package by a user on github and it works fine now. Github Link to the package

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.