Issue 1525: Executing Python script using subprocess.Popen twice interactively fails without error the second time (original) (raw)

Executing script using subprocess.Popen twice interactively fails without error the second time. File a.py:

print "start" import subprocess

print "first call" process = subprocess.Popen( args = "cmd.exe /c echo 1", stdout = subprocess.PIPE)

for line in process.stdout: if not line: break; print line;

print "second call" process = subprocess.Popen( args = "cmd.exe /c echo 2", stdout = subprocess.PIPE)

for line in process.stdout: if not line: break; print line;

print "end"

Executing it in Python on Windows, interactively:

Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import a start first call 1

second call 2

end

import a