Using python 2.7, windows 7 64 bit. I want to call external application to get launch using python script. And after launching external application, the main process should continue and finally terminate without ever waiting or listening for external application to terminate. Means, as external application is launched, main process should not depend on external application for termination. I used:
print "ss"
os.system(r"D:\pythonCode\external.exe")
print "application started"
In above,code, external.exe is launched, but it never prints "application started", and main process so never terminates.
Also tried with:
p = subprocess.Popen([r"D:\pythonCode\external.exe"])
print "application started"
sys.exit(0)
In above case, external.exe is launched, it prints "application started", but main process never terminates. Main process waits for external application to terminates, which is not desired. I also looked into this q&a but not get solution for it.
I also tried with
p=subprocess.Popen([r"D:\pythonCode\external.exe"],creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
, but same blocking happens
and also
DETACHED_PROCESS = 0x00000008
pid = subprocess.Popen([r"D:\pythonCode\external.exe"], creationflags=DETACHED_PROCESS).pid