[英]To terminate the running application in python script
I am writing a simple python script to run and close one flatpak
application. 我正在编写一个简单的python脚本来运行和关闭一个flatpak
应用程序。 I am triggering gedit
application using flatpak
command but having a hard time to figure out how to quit the application from script itself. 我正在使用flatpak
命令触发gedit
应用程序,但很难弄清楚如何从脚本本身退出该应用程序。 Since once the application launches, python scripts waits for the application to terminate and then to exit. 由于应用程序启动后,Python脚本会等待应用程序终止然后退出。
Code: 码:
import os
import sys
def main():
os.system("flatpak run org.gnome.gedit/x86_64/stable")
sys.exit()
if __name__ == '__main__':
main()
In above code I tried sys.exit()
, but it doesn't work as it waits for the application to terminate. 在上面的代码中,我尝试了sys.exit()
,但是它在等待应用程序终止时不起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.