[Python-Dev] sys.__stdout__ - was RE: [Idle-dev] Doc Commentary

Barry A. Warsaw barry@wooz.org
Wed, 25 Oct 2000 20:17:38 -0400 (EDT)


>>>>> "MH" == Mark Hammond <MarkH@ActiveState.com> writes:

    MH> * Tools/il8n/pygettext.py

That's embarassing. ;)

Here's a patch, but I'm not going to check it in because I think a
/much/ better idiom to adopt is to use extended print instead.  I need
to make some updates to pygettext.py soon, so I'll probably just
2.0-ify it at the same time.

-Barry

-------------------- snip snip --------------------
Index: pygettext.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/i18n/pygettext.py,v
retrieving revision 1.9
diff -u -r1.9 pygettext.py
--- pygettext.py	2000/05/02 19:28:30	1.9
+++ pygettext.py	2000/10/26 00:16:22
@@ -283,6 +283,7 @@
         options = self.__options
         timestamp = time.ctime(time.time())
         # common header
+        stdout = sys.stdout
         try:
             sys.stdout = fp
             # The time stamp in the header doesn't have the same format
@@ -314,7 +315,7 @@
                 print 'msgid', normalize(k)
                 print 'msgstr ""\n'
         finally:
-            sys.stdout = sys.__stdout__
+            sys.stdout = stdout
 
 
 def main():