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 pitrou
Recipients Mitchell.Stokes, amaury.forgeotdarc, pitrou
Date 2010-10-13.12:22:30
SpamBayes Score 5.0376997e-07
Marked as misclassified No
Message-id <1286972552.6.0.379885435788.issue10080@psf.upfronthosting.co.za>
In-reply-to
Content
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);
History
Date User Action Args
2010-10-13 12:22:32pitrousetrecipients: + pitrou, amaury.forgeotdarc, Mitchell.Stokes
2010-10-13 12:22:32pitrousetmessageid: <1286972552.6.0.379885435788.issue10080@psf.upfronthosting.co.za>
2010-10-13 12:22:31pitroulinkissue10080 messages
2010-10-13 12:22:30pitroucreate