how to stop info output on screen

Ido.Yehieli at Ido.Yehieli at
Fri Sep 30 14:04:19 CEST 2005

more on the subject: your "print" statments will also be written to
that file that sys.stdout directs to, so maybe that wasn't exactly the
solution you wanted to hear.

ok, not the nicest solution but maybe it will help you anyway:
bind sys.stdout at the begining of the program to a file (don't forget
to save it first! let's say stdout = sys.stdout;
sys.stdout=file('myLogFile.dat','w') ), and write your own print
funktion that goes something like that:
def printToConsole(stringToPrint,oldStdOut):
____print stringToPrint

then when you want to print to the console, use this function instead
of the print statment. all the rest will go to 'myLogFile.dat'


More information about the Python-list mailing list