print to stdout and to a log file.....

Mikael Olofsson mikael at isy.liu.se
Mon Aug 21 08:55:55 EDT 2000


On 21-Aug-00 Amir Mistric wrote:
 >  Hi
 >  If I have a command
 >  os.system("program.exe %s %s" %(file1,file2))
 >  how can I capture the output of this execution to both stdout and to a lets
 >  say log file.....
 >  
 >  I tried
 >  
 >  log_detail = os.popen("program.exe %s %s" %(file1,file2))
 >  LogFile.write("%s" % log_detail.read())

Try the module popen2.

/Mikael

-----------------------------------------------------------------------
E-Mail:  Mikael Olofsson <mikael at isy.liu.se>
WWW:     http://www.dtr.isy.liu.se/dtr/staff/mikael               
Phone:   +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date:    21-Aug-00
Time:    14:55:10

         /"\
         \ /     ASCII Ribbon Campaign
          X      Against HTML Mail
         / \

This message was sent by XF-Mail.
-----------------------------------------------------------------------



More information about the Python-list mailing list