Python: Can't fix IndentationError: expected an indented block
Question: I've messed around with this code in python as much as possible and still
can't seem to get it to work

    
    
    #!/usr/bin/env python
    from time import sleep
    import os
    import RPi.GPIO as GPIO
    
    GPIO.setmode (GPIO.BCM)
    GPIO.setup (23, GPIO.IN)
    
    while True:
        if ( GPIO.input (23) == False ):
            os.system('mpg321 Sioux Goal Horn2.mp3 &')
        sleep (0.1);
    

Every thing I've done to change it, I always get the same message.

    
    
    ~ $ chmod +x ButtonBasedGoalSound.py
    ~ $ sudo python ButtonBasedGoalSound.py
    File "ButtonBasedGoalSound.py" line 9
      os.system(''mpg321 Sioux Goal Horn2.mp3 &')
       ^
    IndentationError: expected an indented block
    

I'd appreciate some help!


Answer: Check whether you have mixed tabs and spaces on that line. Indent with spaces
only! Otherwise you will experience great pain.

