I am writing a simple python script to run and close one flatpak
application. I am triggering gedit
application using flatpak
command but having a hard time to figure out how to quit the application from script itself. Since once the application launches, python scripts waits for the application to terminate and then to exit.
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.
you can try this
import subprocess
p = subprocess.Popen("flatpak run org.gnome.gedit/x86_64/stable")
p.terminate()
Here you can find more information about this
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.