Appending a log file and see progress as program executes

Grant Edwards grante at visi.com
Wed May 30 14:30:02 EDT 2007


On 2007-05-30, Karim Ali <kakeez at hotmail.com> wrote:
> Hi,
>
> I am writing a program that will take several days to execute :) and would 
> like to append to a log file but be able to open that file at any time and 
> see the errors that have occured.
>
> So this is what I am doing:
>
> ----------------------------------------------
> flog = open('out.log', 'a')
> ....
> when needed:
> sys.stdout=flog
> print "error message"

sys.stdout.flush()

-- 
Grant Edwards                   grante             Yow! Do I have a lifestyle
                                  at               yet?
                               visi.com            



More information about the Python-list mailing list