Subprocess.Popen stdin in new console
<p>I want to execute a python subprocess in a new console. Once started, I want the user to be able to answer questions asked by this new process on stdin.</p>

<p>I tried the following code:</p>

<pre><code>p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd, creationflags=subprocess.CREATE_NEW_CONSOLE)
(o, e) = p.communicate()
</code></pre>

<p>As soon as the subprocess asks for input on stdin the following error message is displayed:</p>

<blockquote>
  <p>EOFError: EOF when reading a line</p>
</blockquote>

<p>Is it the good way to achieve this ?</p>

<p>As i'm not really interested in the stdout/stderr redirection, i tried this way: </p>

<p><code>subprocess.Popen(cmd, cwd=cwd, creationflags=subprocess.CREATE_NEW_CONSOLE)</code></p>

<p>It works fine now. I guess that it's not compatible to redirect standard input/outputs and to create a new console.</p>

python subprocess stdin