diff options
| author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-04-21 22:35:30 (GMT) | 
|---|---|---|
| committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-04-21 22:35:30 (GMT) | 
| commit | dd8d824a560a27b00ff0dc111a0b1744d4418dda (patch) | |
| tree | b5c9f23e82746fa09a3f8d63d41d963c2be3ebaa /Lib/idlelib/configHandler.py | |
| parent | 265d7384b9e9cd32630ae28b05f04c1bc4fd9133 (diff) | |
| download | cpython-dd8d824a560a27b00ff0dc111a0b1744d4418dda.zip cpython-dd8d824a560a27b00ff0dc111a0b1744d4418dda.tar.gz cpython-dd8d824a560a27b00ff0dc111a0b1744d4418dda.tar.bz2  | |
Issue 2665: On Windows, sys.stderr does not contain a valid file when running without a console.
It seems to work, but will fail at the first flush.
This causes IDLE to crash when too many warnings are printed.
Will backport.
Diffstat (limited to 'Lib/idlelib/configHandler.py')
| -rw-r--r-- | Lib/idlelib/configHandler.py | 20 | 
1 files changed, 16 insertions, 4 deletions
diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py index 681ff1e..3fc2a60 100644 --- a/Lib/idlelib/configHandler.py +++ b/Lib/idlelib/configHandler.py @@ -204,7 +204,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? @@ -247,7 +250,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): @@ -356,7 +362,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 @@ -610,7 +619,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):  | 
