我想在Eye of Gnome(eog)中查看图像,然后让它自动关闭。 我不太熟悉子进程,但到目前为止我已经尝试过了:
eog = subprocess.Popen('oeg <some file>', shell=True)
# ...Code, Code, Code...
eog.kill()
或
eog.terminate()
都没有工作。有什么帮助吗?
答案 0 :(得分:3)
请勿使用shell=True
,例如:
import subprocess, shlex
command = 'eog <filename'>
eog = subprocess.Popen(shlex(command))
..code..
eog.kill()