summaryrefslogtreecommitdiff
path: root/Lib/idlelib/configHandler.py
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-04-21 22:42:30 +0000
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-04-21 22:42:30 +0000
commitf305bd3ea25f58171b00afcef386cdbf16336890 (patch)
tree1d30735d23c330e88be172c85b2776d62bcca6cc /Lib/idlelib/configHandler.py
parent0f1653e957cf519215af33dec61dc4808077bec2 (diff)
downloadcpython-git-f305bd3ea25f58171b00afcef386cdbf16336890.tar.gz
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 silently crash when too many warnings are printed. Backport of r62448.
Diffstat (limited to 'Lib/idlelib/configHandler.py')
-rw-r--r--Lib/idlelib/configHandler.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py
index 3ddb4ed82d..fada4eb015 100644
--- a/Lib/idlelib/configHandler.py
+++ b/Lib/idlelib/configHandler.py
@@ -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):