Redirecting both stdout and stderr to the same file

Randy Kreuziger KREUZRSK at DFW.WA.GOV
Tue Dec 27 18:56:40 EST 2005


Can stdout and stderr be redirected to the same file?  I would like to redirect both to the same file but I'm not sure how to do it.  Currenting I'm redirectiong stdout using the following code:
   saveout = sys.stdout
   fsock = open('runtime.log', 'w')
   sys.stdout = fsock
 
The problem is that when en error occurs that my program was not written to handle that error message is being sent to the cmd window and not my log file.  My program may simply need to be more robust however I'm still a python novice.
 
Thanks
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20051227/7757c5a9/attachment.html>


More information about the Python-list mailing list