Antoine Pitrou <pit...@free.fr> added the comment:

I don't think freopen() is the right solution, since it might open another 
(different) file descriptor under the hood; but Python always uses file 
descriptor 1 when creating sys.stderr.

I would suggest instead something such as (untested):

int tmpfd;
tmpfd = open("myfile.txt", O_CREAT | O_WRONLY);
dup2(tmpfd, 1);

----------
nosy: +pitrou

_______________________________________
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

Reply via email to