<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2>    From My Application, iam 
creating Multiple thread..</FONT></DIV>
<DIV><FONT face=Arial size=2>    Each thread will acesss this 
function RedirectStdOut.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>    sys.stdout is a global 
pointer..</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>    So i got an exception called 
"I/O Operation on Closed File"..</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>    How to solve this 
problem..Kindly give some solution..</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>    is it possible to put a lock for 
each thread..so that one thread accessing the RedirectStdOut, other thread can 
wait untill the lock get released.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>    if so, i kindly request you to 
give some sample program...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>    </FONT></DIV>
<DIV><FONT face=Arial size=2>    </FONT></DIV>
<DIV><FONT face=Arial size=2>    </FONT><FONT face=Arial 
size=2>def RedirectStdOut():<BR>        print 
"This is stdout"<BR>        oldStd = 
sys.stdout<BR>        sys.stdout = 
open("c:\\std.out", "w")<BR>        print "This is 
Redirecting stdout to a file"<BR>        
sys.stdout.flush()<BR>        
sys.stdout.close()<BR>        sys.stdout = 
oldStd    </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks in advance</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Regards</FONT></DIV>
<DIV><FONT face=Arial size=2>Bala</FONT></DIV></BODY></HTML>