K
Karim Ali
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"
------------------------------------------------
This will print directly to log. I use sys.stdout so i can quickly (in code)
change back and forth between errors displayed on screen and errors logged..
This works great. The only problem is that I cant see anything in the log
file when I try to open it say with notepad while the program is
running...and this is not good at all!
Any suggestions are appreciated.
Karim
_________________________________________________________________
See Fireworks On Live Image Search
http://search.live.com/images/results.aspx?q=Fireworks&mkt=en-ca&FORM=SERNEP
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"
------------------------------------------------
This will print directly to log. I use sys.stdout so i can quickly (in code)
change back and forth between errors displayed on screen and errors logged..
This works great. The only problem is that I cant see anything in the log
file when I try to open it say with notepad while the program is
running...and this is not good at all!
Any suggestions are appreciated.
Karim
_________________________________________________________________
See Fireworks On Live Image Search
http://search.live.com/images/results.aspx?q=Fireworks&mkt=en-ca&FORM=SERNEP