Redirection of stdout fails on Windows

Daniel Dittmar daniel.dittmar at sap.com
Fri Oct 10 04:45:59 EDT 2003


Joel Wagner wrote:
>     python tst.py > out
>
> I get the expected string 'a b c' in the file 'out'.
>
> When run like this:
>
>     tst > out
>
> I get an error message 'The handle is invalid' and nothing in the
> file 'out'.

This is a bug in cmd.exe. If script is started by looking at the extension
and then finding the real executable through the registry, redirection does
not work.

I think the easiest work around is to create batch files for every python
script you want to execute.

Daniel







More information about the Python-list mailing list