Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I tested this on my Windows machine and it works if you specify the Python exe: </p> <pre><code>C:\&gt;C:\Python25\python.exe output.py | C:\Python25\python.exe input.py Give me the greeting. The greeting is: hello </code></pre> <p>But I get an EOFError also if running the commands directly as: </p> <pre><code>output.py | input.py </code></pre> <p>I'm not sure exactly why that is, I'm still looking into this one but at least this should provide you with a workaround for now. It may have something to do with the way the file handler is invoked for .py files. </p> <p><strong>UPDATE</strong>: well, what do you know. Looks like this is actually a bug in Windows where stdin/stdout redirection may not work properly when started from a file association. So the workaround is as noted by myself and Patrick, you need to specify "python" will be running input.py, otherwise it will not redirect stdout from output.py to the stdin for input.py correctly. </p> <p><em>Reference</em>:</p> <p><strong><a href="http://mail.python.org/pipermail/python-bugs-list/2004-August/024923.html" rel="noreferrer">http://mail.python.org/pipermail/python-bugs-list/2004-August/024923.html</a></strong> </p> <p><strong><a href="http://support.microsoft.com/default.aspx?kbid=321788" rel="noreferrer">http://support.microsoft.com/default.aspx?kbid=321788</a></strong></p> <p><strong>UPDATE 2</strong>: </p> <p>To change this behavior and make Windows pipes work as expected for stdin/stdout redirection, you can add this value to the registry (tested on my box and verified this works as desired).</p> <blockquote> <ol> <li>Start Registry Editor.</li> <li><p>Locate and then click the following key in the registry:</p> <p><strong>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer</strong></p></li> <li><p>On the Edit menu, click Add Value, and then add the following registry value:</p> <p>Value name: <em>InheritConsoleHandles</em><br /> Data type: <em>REG_DWORD</em><br /> Radix: Decimal<br /> Value data: 1</p></li> <li><p>Quit Registry Editor.</p></li> </ol> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload