Antoine Pitrou <pit...@free.fr> added the comment: > Also, dup2 is not available on Windows (at least not from what I've > read).
MSDN says dup2 is deprecated but you can use _dup2 instead: http://msdn.microsoft.com/en-us/library/8syseb29%28v=VS.80%29.aspx > From my understanding, freopen() is supposed to be the portable way to > redirect stdout. I'm not sure, but as I said Python does not use C's "stdout". Instead, it writes directly (using write()) to the file descriptor number 1. So, if freopen() creates a different file descriptor for the C stdout, Python's stdout will not be redirected where you want it to be. I'm not saying that's what happens in your program, though. You could call _fileno(stdout) after the reopen() call to check if it's still 1 or not. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10080> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com