Gabriel Genellina wrote: > At Thursday 7/12/2006 23:21, Cameron Walsh wrote: > > > > Here is my problem. I want to log everything displayed in the screen > > > after I start the main python script. Things include unhandled > > > exceptions , message from print statement and other sources. > > > Basically, if it is displayed on the screen, I want to log it.. > > > >If it's on linux you can just redirect the screen output to a file: > > > >python initialfile.py 1>stdout.txt 2>stderr.txt > >[...] > > > >As for windows, I'll test it now... > > > >It turns out you can at least redirect the output to a file, I'm not > >sure what it does with standard error or even if it exists or not. > > > >python initialfile.py > output.txt > > It's the same syntax as noted for linux above. 1> is the same as > alone. > > If ALL the testing is done on a single program (that is, no os.system > or spawn or subprocess...) then you could just replace sys.stdout and > sys.stderr with another open file (or file-like) object. > Redirection in Windows is explained here:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true -- http://mail.python.org/mailman/listinfo/python-list