I'm getting a RuntimeWarning: This channel is already in use, continuing anyway. from a line of code that gets run many times with different pins. I'm concerned that I may be trying to use a GPIO pin that was already being used for something else (for example, I already found one where I was using an I2C pin for GPIO while also using I2C). How can I figure out which pin is causing the error without just manually checking each one?

I tried looking for something like issetup() or similar to check before I run setup, but nothing like that appears to exist.

1 Answer 1


You could just ignore the warning.

Alternatively I thought the warning told you what to do if you don't want the warning printed.

Alternatively call the cleanup() method before exiting the script.

Alternatively see which GPIO are exported.

$ ls /sys/class/gpio
export  gpio23  gpiochip0  gpiochip100  unexport

This shows that GPIO23 is in use.

  • I edited the question to point out that I don't want to just ignore the warning- I think it may be pointing out a real problem. The check suggestion is useful though. For anyone else that wants to do it in-program, I figured out that os.listdir('/sys/class/gpio') works similarly.
    – ericksonla
    Commented Feb 1, 2017 at 18:05

Your Answer

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

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