Swapping out sys.stdout globally
Skip Montanaro
skip at pobox.com
Fri Mar 1 10:53:34 EST 2002
Kevin> sys.stdout = NewFile()
Kevin> sys.stderr = NewFile()
Kevin> However, I have some logging routines in a separate package that
Kevin> already have their own references to sys.stdout and sys.stderr
Kevin> which are unaffected by this.
Sounds like they use something like
from sys import stdout,stderr
The best solution there would be for those packages to import sys in the
usual fashion:
import sys
and refer to sys.stdout & sys.stderr.
--
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)
More information about the Python-list
mailing list