Jun-01-2018, 01:57 PM
Hi,
New to Python but loving it. I am trying to run another python script using subprocess.Popen and have it run in the background. It works ok if I run it from the command line, however if I run it using our batch scheduling solution which is BMC Control-M the scripts starts but does not finish as it seems to be waiting for the child process to finish. If I kill the python running process the job completes successfully.
Any help appreciated.
Regards
Brian
New to Python but loving it. I am trying to run another python script using subprocess.Popen and have it run in the background. It works ok if I run it from the command line, however if I run it using our batch scheduling solution which is BMC Control-M the scripts starts but does not finish as it seems to be waiting for the child process to finish. If I kill the python running process the job completes successfully.
Any help appreciated.
Regards
Brian
import subprocess def startlogging(): DETACHED_PROCESS=0x0000008 pid = subprocess.Popen(["python", "scriptname.py"], creationflags=DETACHED_PROCESS).pid pidid = str(pid) with open(Tr_Fj_Params.pid_file, "w") as f: wtrite_data = f.write(pidid) f.close() if __name__ =='__main__': startlogging()