[英]How to make executable run in background using python?
My problem is that I don't know how to release a resources using python. 我的问题是我不知道如何使用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. 我正在使用Ubuntu Linux并尝试调用某些应用程序,但是当它被调用时,它不会释放资源,而只是挂起。 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) subprocess.Popen([path_to_app],shell = True)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.