2014-01-30 43 views
0

我这个代码周围乱七八糟的蟒蛇尽可能仍然似乎无法得到它的工作的Python:无法修复IndentationError:预计缩进块

#!/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); 

每一件事情我我已经做了改变,我总是得到相同的信息。

~ $ 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 

我很感谢一些帮助!

回答

0

检查该行上是否有混合的制表符和空格。只用空格缩进!否则,你会遇到很大的痛苦。

相关问题