New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problems with os.system and shell redirection on Windows XP #43148
Comments
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 N.B. sorry for italian error messages. With the following script: # redirection.py
import os
import sys
os.system(sys.argv[1]) When doing: I obtain: Instead with: svn: Errore di scrittura: Bad file descriptor This is a Python problem because with an equivalent // redirection.c++
#include <cstdlib>
int main(int argc, char** argv) {
std::system(argv[1]);
} there are no problems. Thanks and regards Manlio Perillo |
Logged In: YES Sorry, there's nothing Python can do about this -- it's a For example, here I'll reproduce your symptoms exactly with C:\Perl\bin>type blah1.pl C:\Perl\bin>blah1.pl > out.txt C:\Perl\bin>type blah2.pl C:\Perl\bin>blah2.pl > out.txt The simplest and most reliable workaround is to put the path C:\Perl\bin>.\perl blah1.pl > out.txt C:\Perl\bin>type out.txt Directory of C:\Perl\bin 04/05/2006 02:29 PM <DIR> . C:\Perl\bin>.\perl blah2.pl > out.txt C:\Perl\bin>type out.txt |
Logged In: YES Thanks for the detailed response. As a joke, I have written this code at the begin of the script: os.dup2(2, 3) # backup fd 2
os.dup2(1, 2)
os.dup2(2, 1)
os.dup2(3, 2) # restore fd 2 and it *seems* to work! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: