我试着建立一个非常简单的脚本来处理通过vlc在raspberry Pi3模型B上播放训练视频
我可以引导到CLI并很好地运行该程序,但是如果将其添加到rc.本地,我在第60行得到一个错误,eoferor:EOF,当读取一行时 有人能帮我弄清楚吗?
第60行是"entry = input("\nVideo to play: ")"
指向这个exert的底部,超过这一点,代码几乎是一样的。
import os,subprocess
entry = " " #variable to hold input on the main menu
entry2 = " " #variable to hold input on the VERVE menu
looping = False #variable that decides if videos should loop
lastinput = " " #variable holds last input on the main menu
while entry != "0":
if entry == "1":
lastinput = "Camco Chemical Safety Training"
elif entry =="2":
lastinput = "[ENG] Forklift Operator Safety Training"
elif entry =="3":
lastinput = "[ESP] Forklift Operator Safety Training"
elif entry =="4":
lastinput = "[ENG] The New Hazard Communication Mandate"
elif entry =="5":
lastinput = "[ESP] The New Hazard Communication Mandate"
elif entry =="6":
lastinput = "Forklift Training (1 of 2)"
elif entry =="7":
lastinput = "Forklift Training - Accidents (2 of 2)"
#open main menu
os.system("printf '\033c'") #These lines are what wipe out the text from the last screen
if looping == True:
print("VIDEOS ARE CURRENTLY LOOPING")
print("Last video watched: " + lastinput)
print("\n1. Camco Chemical Safety Training")
print("2. [ENG] Forklift Operator Safety Training")
print("3. [ESP] Forklift Operator Safety Training")
print("4. [ENG] The New Hazard Communication Mandate")
print("5. [ESP] The New Hazard Communication Mandate")
print("6. Forklift Training (1 of 2)")
print("7. Forklift Training - Accidents (2 of 2)")
print("8. VERST DHL")
print("\n9. TOGGLE VIDEO LOOP")
print("0. Close Program")
print("\nPress 0 at any time during a video to close it.")
entry = input("\nVideo to play: ")
if entry == "1":
#open Camco Chemical Safety Training - if looping is off, play once, if it's on, play forever.
if looping == False:
subprocess.call(['vlc', "/home/pi/Desktop/Training/Camco_Training/Camco.mp4", '-Idummy --play-and-exit'])
elif looping == True:
subprocess.call(['vlc', "/home/pi/Desktop/Training/Camco_Training/Camco.mp4", '-Idummy --loop'])
continue
佩德罗是对的,我能通过改变装载方式使它运行起来。它运行得很好,现在我把它从rc.本地并添加到bashrc
已引导rpi到cli
最后一行
^{pr2}$相关问题 更多 >
编程相关推荐