This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients
Date 2006-04-05.18:40:39
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=31435

Sorry, there's nothing Python can do about this -- it's a
well-known family of Windows bugs, and affects all scripts
(regardless of language) that try to combine command line
I/O redirection with implicit determination of the
executable via file association.  As you've discovered, it
doesn't effect .exe files (which is why your C++ example
isn't relevant).  Various versions of Windows fail in
various ways, but in no version of Windows to date have all
the redirections bugs been fixed.

For example, here I'll reproduce your symptoms exactly with
Perl scripts on WinXP, although the error messages are English:

C:\Perl\bin>type blah1.pl
system("dir");

C:\Perl\bin>blah1.pl > out.txt
There is not enough space on the disk.

C:\Perl\bin>type blah2.pl
system("svn help");

C:\Perl\bin>blah2.pl > out.txt
svn: Write error: Bad file descriptor

The simplest and most reliable workaround is to put the path
to the executable first on the command line.  Here are the
same Perl examples doing that; the same kind of thing works
for all cases in which Windows redirection doesn't work
(including, of course, Python):

C:\Perl\bin>.\perl blah1.pl > out.txt

C:\Perl\bin>type out.txt
 Volume in drive C has no label.
 Volume Serial Number is 5C0F-48E6

 Directory of C:\Perl\bin

04/05/2006  02:29 PM    <DIR>          .
04/05/2006  02:29 PM    <DIR>          ..
02/04/2003  03:35 PM            90,175 a2p.exe
[etc]

C:\Perl\bin>.\perl blah2.pl > out.txt

C:\Perl\bin>type out.txt
usage: svn <subcommand> [options] [args]
Subversion command-line client, version 1.2.3.
[etc]
History
Date User Action Args
2007-08-23 14:39:04adminlinkissue1463104 messages
2007-08-23 14:39:04admincreate