underground-software / RPi.GPIO2

GNU General Public License v3.0
22 stars 13 forks source link

Running failed setup() before setmode() results in subsequent setup() call failing due to pin "being in use" #56

Open theyoyojo opened 2 years ago

theyoyojo commented 2 years ago
>>> GPIO.setup(40, GPIO.OUTPUT)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'RPi.GPIO' has no attribute 'OUTPUT'
>>> GPIO.setup(40, GPIO.OUT)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rpi/RPi.GPIO2/RPi/core.py", line 1098, in setup
    channel[i] = channel_fix_and_validate(channel[i])
  File "/home/rpi/RPi.GPIO2/RPi/core.py", line 351, in channel_fix_and_validate
    raise RuntimeError("Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)")
RuntimeError: Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)
>>> GPIO.setmode(GPIO.BOARD)
>>> GPIO.setup(40, GPIO.OUT)
/home/rpi/RPi.GPIO2/RPi/core.py:1109: UserWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
                     Further attemps to use channel 21 will fail unless setup() is run again sucessfully
  warn("This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.\n \
>>> GPIO.setup(40, GPIO.OUT)
theyoyojo commented 2 years ago

Or maybe the warning is just wrong. Not sure