Sep-13-2017, 09:54 AM
Hello,
the script below (a python process is called, which calls a waitfor cmd with a timeout of 4 seconds) is supposed to end after 4 seconds. But instead proc.communicate stops after the 20 seconds timeout.
Why???
the script below (a python process is called, which calls a waitfor cmd with a timeout of 4 seconds) is supposed to end after 4 seconds. But instead proc.communicate stops after the 20 seconds timeout.
Why???
import subprocess if __name__ == "__main__": proc_str = ["C:\\Program Files (x86)\\Anaconda3\\Python.exe", "-c", "import subprocess;subprocess.run('cmd /S /C waitfor g /t 200', shell=False, timeout=4)"] proc = subprocess.Popen(proc_str, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=False, universal_newlines=True) (proc_out, proc_err) = proc.communicate(timeout=20) if (proc.returncode == 0): pass