sys.stdout redirection

Bala blk at srasys.co.in
Mon Jul 19 08:44:41 CEST 2004


Hi,
    Iam redirecting the sys.stdout to the file. iam doing this is multiple thread.

While running my application exception throws "Value.error I/O Operation on closed file"

I want to know whether, this exception is coming because of  the thread or sys.stdout.

what could be the problem...hove to overcome this problem..

thanks in advance. Kindly give some solution for this problem

import sys


boolStdOut = True
if boolStdOut == 1:
    print "This is stdout"
    oldStd = sys.stdout
    sys.stdout = open("c:\\std.out", "w")
    print "This is Redirected stdout to the file"
    sys.stdout.flush()
    sys.stdout.close()
    sys.stdout = oldStd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040719/5fede2e7/attachment.html>


More information about the Python-list mailing list