从 python 脚本在 ubuntu 上打开游戏

open games on ubuntu from python script

我正在构建一个可以执行某些任务的 python 脚本。我现在专注于打开和应用我使用的脚本 subprocess.call 和 os.startfile 但没有任何帮助并返回错误代码是 -

import os
while True:
message=raw_input("Enter your message >> ")
if message=="quit":
    exit()
elif message=="bye":
    exit()
elif message=="bye bye":
    exit()
elif message=="good bye":
    exit()
elif message=="see u":
    print "Okay then :)"
    exit()
elif message=="open games":
    print "on to that"
    os.start(gnome-mines)

感谢任何帮助

os.startfile 仅适用于 Windows。 请check here!!!

而不是 os.startfile,使用 os.system

确保文件和用户具有执行权限。

您必须输入要打开的文件的完整路径

elif message=="open games":
print "on to that"
os.system("/usr/games/gnome-mines")