]> granicus.if.org Git - python/commitdiff
Issue 2665: On Windows, sys.stderr does not contain a valid file when running without...
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>
Mon, 21 Apr 2008 22:42:30 +0000 (22:42 +0000)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>
Mon, 21 Apr 2008 22:42:30 +0000 (22:42 +0000)
It seems to work, but will fail at the first flush.

This causes IDLE to silently crash when too many warnings are printed.

Backport of r62448.

Lib/idlelib/NEWS.txt
Lib/idlelib/configHandler.py

index 92ff0ff1cd84dbca132c4284a9b50fcda5a06275..7329ee9d73fde546747908a842cd6a1ccf64fe9c 100644 (file)
@@ -1,8 +1,11 @@
 What's New in IDLE 1.2.3c1?
-=========================
+===========================
 
 *Release date: XX-XXX-2008*
 
+- Issue #2665: On Windows, an IDLE installation upgraded from an old version
+  would not start if a custom theme was defined.
+
 
 What's New in IDLE 1.2.2?
 =========================
index 3ddb4ed82d0948519d072fefc05f08f97ded5226..fada4eb0156f532eabd92260875d9355ff571c64 100644 (file)
@@ -207,7 +207,10 @@ class IdleConf:
             if not os.path.exists(userDir):
                 warn = ('\n Warning: os.path.expanduser("~") points to\n '+
                         userDir+',\n but the path does not exist.\n')
-                sys.stderr.write(warn)
+                try:
+                    sys.stderr.write(warn)
+                except IOError:
+                    pass
                 userDir = '~'
         if userDir == "~": # still no path to home!
             # traditionally IDLE has defaulted to os.getcwd(), is this adequate?
@@ -248,7 +251,10 @@ class IdleConf:
                            ' from section %r.\n'
                            ' returning default value: %r\n' %
                            (option, section, default))
-                sys.stderr.write(warning)
+                try:
+                    sys.stderr.write(warning)
+                except IOError:
+                    pass
             return default
 
     def SetOption(self, configType, section, option, value):
@@ -357,7 +363,10 @@ class IdleConf:
                            '\n from theme %r.\n'
                            ' returning default value: %r\n' %
                            (element, themeName, theme[element]))
-                sys.stderr.write(warning)
+                try:
+                    sys.stderr.write(warning)
+                except IOError:
+                    pass
             colour=cfgParser.Get(themeName,element,default=theme[element])
             theme[element]=colour
         return theme
@@ -611,7 +620,10 @@ class IdleConf:
                                '\n from key set %r.\n'
                                ' returning default value: %r\n' %
                                (event, keySetName, keyBindings[event]))
-                    sys.stderr.write(warning)
+                    try:
+                        sys.stderr.write(warning)
+                    except IOError:
+                        pass
         return keyBindings
 
     def GetExtraHelpSourceList(self,configSet):