Reputation: 197
Whenever I run subprocess.run({file location})
my whole script hangs until I have closed the windows app that I opened with subprocess.run({file location})
. The exception doesn't catch it, what should I do?
My code looks like this
def open_app(location):
try:
subprocess.run(location)
except subprocess.SubprocessError as error:
print(error)
Upvotes: 1
Views: 1840
Reputation: 4843
subprocess.run
specifically waits for the process to finish before continuing with the rest of your script. If you want to run it in the background use subprocess.Popen
Upvotes: 1