Redirection of stdout fails on Windows

Joel Wagner joel.wagner at veritas.com
Thu Oct 9 16:22:52 EDT 2003


I have a simple test program tst.py:

    import os
    os.system('echo a b c')

When run like this:

    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'.

Using ActiveState Python 2.2.2 on Windows/XP Pro.

Any ideas on what the root cause is?

Thanks,

Joel




More information about the Python-list mailing list