My python script was executed in the past 10 days without issues. I had to do some troubleshooting to find what is causing the problem.

Here is part of my code where the issue is caused:

from mfrc522 import SimpleMFRC522
import RPi.GPIO as GPIO

def Employee():
       reader = SimpleMFRC522()
       cardData = reader.read()
       employeeId = cardData[1].strip('\x00').strip()
       return employeeId[1:len(employeeId)]


RuntimeWarning: This channel is already in use, continuing anyway.
**GPIO.setup(pin_rst, GPIO.OUT)**

I did some research but I couldn't find the solution for my problem.


  • What research did you do? What does the documentation for RPi.GPIO say?
    – joan
    Oct 20, 2022 at 10:12
  • to add finally:GPIO.cleanup(); about GPIO.setup(22, GPIO.OUT) - which it didn't fix the problem. RPi.GPIO it points out to use GPIO.cleanup() in the end of the function.
    – Maria
    Oct 20, 2022 at 10:16
  • It is futile posting code fragments. Post real executable code. Frankly this just looks like poorly structured code. If you don't want to correctly terminate your code try gpiozero which does it automatically (and is easier to use)
    – Milliways
    Oct 20, 2022 at 10:23
  • @Milliways the purpose of this function just to read the number from the card and print it. As I said, this function was ok for 10 days.
    – Maria
    Oct 20, 2022 at 10:25
  • 1
    I will point out that the warning message (the subject of your question) is not caused by a loose cable.
    – joan
    Oct 20, 2022 at 14:59


Your Answer

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

Browse other questions tagged or ask your own question.