简体   繁体   中英

How to make executable run in background using python?

My problem is that I don't know how to release a resources using python.

I'm using Ubuntu Linux and trying to call some application, but when it is called, it doesn't release resources, it just hangs. I know about & but it gets passed as argument to application, it doesn't execute application in background.

My code:

import os, subprocess

path_to_app = os.path.join('/', 'usr', 'bin', 'firefox')

subprocess.Popen([path_to_app], '&')

print("Something..") # Hangs until app is closed

How to just run application and move on, without hanging ?

I solved it somehow using:

subprocess.Popen([path_to_app], shell=True)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM