python - How to prevent subprocess.popen to "get lost" in Windows? -
python - How to prevent subprocess.popen to "get lost" in Windows? -
i have somehow curious python(3.x) problem: want create timer calls external programme (.exe) @ predefined time - (simplified below, additionally there countdown output):
time.sleep(y) x=popen("pathto.exe")
if test code works want little y. big y (wait more few hours), python doesnt execute popen command (but there arent errors well). other "normal" code after popen command (for illustration email notification in case) works fine.
im not exclusively sure if windows (im working on 64bit windows 7, disabled energy saving features im aware of) or python problem couldnt find solution far: tried several additional arguments popen (shell/no shell, etc.) , tried open program/define x ahead of waiting period , close afterwards 1 time again nil solved unfortunately.
many thanks!
edit: more detailed code example:
while 1: if time.mktime(trade2)<=time.time(): break else: dif=time.mktime(trade2)-time.time() # visible countdown aus=time.gmtime(dif) sys.stdout.flush() print("\b\b\b\b\b\b\b\b\b", end="\r") print(aus[3],aus[4],aus[5], sep=":",end="") time.sleep(0.5) x=subprocess.popen("c:/xyz/abc.exe") print("sending mail...")
the print() executed expected, popen when countdown less approx 1-2hours.
sleep not have guaranteed wake time. according docs sleep may lastly longer or shorter amount of time requested. i've answered question before on so, alternatives.
python windows-7 subprocess exe popen
Comments
Post a Comment