问题描述
它可以在VS CODE终端上运行,但不能在linux终端上运行。错误:
File "/home/shaheer/start.py",line 10,in <module>
ques = input("Are you ready? (y/n)")
EOFError: EOF when reading a line
我的代码:
import os
import subprocess
from subprocess import Popen,PIPE,STDOUT
from subprocess import DEVNULL
import webbrowser
import time
time.sleep(10)
ques = input("Are you ready? (y/n)")
if ques == "y":
print("Good!")
elif ques == "Y":
print("Good!")
else:
cmd = "pkill chrome"
Popen([cmd],stderr=subprocess.DEVNULL,stdin=PIPE,shell=True)
我将其用作提醒脚本,以供长时间使用系统的人使用。
解决方法
[更新]现在正在工作,我不得不制作另一个.py文件并将其链接到该文件。 文件1(start.py):
const roles = this.reflector.getAllAndOverride(
'roles',[
context.getHandler(),context.getClass()
]
);
文件2(playsound.py):
import os
os.system("python3 /home/shaheer/playsound.py")