The problem I need to solve is how to launch a program from python3 in such a way that control is passed back to the python script to do other things. I have experimented with os.system and subprocess.call as so
import subprocess, os
os.system('gedit&')
subprocess.call(['gedit','&'])
both of which seem to wait for gedit, in a sence like it is waiting on some sort of stream from gedit. If I type gedit & at the terminal I get the desired effect outside of python.
1 Answer 1
Use subprocess.Popen:
subprocess.Popen(['gedit'])
subprocess.call essentially does the above line, but then calls communicate on the resulting object, which waits for it to exit. Since you don't want to wait, you can just not call communicate, and the process will be created, leaving your process to go on its merry way.