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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -