How to find out if there is data to be read from stdin on Windows in Python?
<p>This code</p>

<pre><code>select.select([sys.stdin], [], [], 1.0)
</code></pre>

<p>does exactly what I want on Linux, but not in Windows.</p>

<p>I've used <code>kbhit()</code> in <code>msvcrt</code> before to see if data is available on stdin for reading, but in this case it always returns <code>0</code>.  Additionally <code>msvcrt.getch()</code> returns <code>'\xff'</code> whereas <code>sys.stdin.read(1)</code> returns <code>'\x01'</code>.  It seems as if the msvcrt functions are not behaving properly.</p>

<p>Unfortunately I can't use TCP sockets as I'm not in control of the application talking my Python program.</p>
