在启动时加载脚本后出现错误 EOFerror: Script is running in CLI mode。读取一行时的 EOF。
条形码:回溯(最近一次调用最后一次):文件“/home/pi/BCKHL.py”,第 48 行,在 compare() 文件“/home/pi/BCKHL.py”,第 20 行,在 comparebarcode=input (“条码:”)
手动运行时脚本正在运行。
这是脚本的代码:
import RPi.GPIO as GPIO
###setup###
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(18, GPIO.OUT) #Ventil 1#
GPIO.output(18, GPIO.LOW)
GPIO.setup(21, GPIO.OUT) #Ventil 2#
GPIO.output(21, GPIO.LOW)
GPIO.setup(38, GPIO.OUT) #Ventil 1 crvena led#
GPIO.output(38, GPIO.HIGH)
GPIO.setup(40, GPIO.OUT) #Ventil 1 zelena led#
GPIO.output(40, GPIO.LOW)
GPIO.setup(35, GPIO.OUT) #Ventil 2 crvenaled#
GPIO.output(35, GPIO.HIGH)
GPIO.setup(37, GPIO.OUT) #Ventil 2 zelena led lampa#
GPIO.output(37, GPIO.LOW)
def compare():
while True:
barcode=input("Barcode:")
if barcode=="S5000070931":
GPIO.output(18, GPIO.HIGH)
GPIO.output(21, GPIO.LOW)
GPIO.output(38, GPIO.LOW)
GPIO.output(40, GPIO.HIGH)
GPIO.output(35, GPIO.HIGH)
GPIO.output(37, GPIO.LOW)
continue
elif barcode=="S5000057670":
GPIO.output(18, GPIO.LOW)
GPIO.output(21, GPIO.HIGH)
GPIO.output(40, GPIO.LOW)
GPIO.output(38, GPIO.HIGH)
GPIO.output(35, GPIO.LOW)
GPIO.output(37, GPIO.HIGH)
continue
else:
print("Molim Vas da skenirate ispravan barkod")
GPIO.output(18, GPIO.LOW)
GPIO.output(21, GPIO.LOW)
GPIO.output(38, GPIO.HIGH)
GPIO.output(35, GPIO.HIGH)
GPIO.output(40, GPIO.LOW)
GPIO.output(37, GPIO.LOW)
continue
compare()
有谁知道如何解决这个问题?
谢谢你。