timeout - Python script executes another script and resumes after second script completes its job -
is there way check if subprocess has finished job? python script executes 123.exe cmd. 123.exe things , in end writes 1 or 0 txt file. python script reads txt file , continues job if '1' , stops if '0'. @ moment can think of, put python script sleep minute. way 123.exe has written 1 or 0 txt file. realization simple @ same time stupid.
so question is, there way deal problem without need timeout? way make python script wait til 123.exe stops?
use:
retcode = subprocess.call(["123.exe"])
this execute command, wait until finishes, , return code retcode
(this way avoid need of checking output status file, if command returns proper return code).
if need instantiate manually subprocess.popen
, go for
popen.wait()
(and check popen.returncode
).
Comments
Post a Comment