diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2014-09-20 02:38:41 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2014-09-20 02:38:41 (GMT) |
commit | 81b062f63ace48983439857314fec8063e8c72e0 (patch) | |
tree | a03a857a0cafa21b3016064bb86881f5b0395ab9 /Lib/idlelib/configHandler.py | |
parent | cbfaa7b9d3174d6304ec3b5ab165b5c3514c5d34 (diff) | |
download | cpython-81b062f63ace48983439857314fec8063e8c72e0.zip cpython-81b062f63ace48983439857314fec8063e8c72e0.tar.gz cpython-81b062f63ace48983439857314fec8063e8c72e0.tar.bz2 |
Issue #22420: Avoid 'write to None' crashes by using print instead.
Change a couple of existing prints. Original patch by Serhiy Storchaka.
Diffstat (limited to 'Lib/idlelib/configHandler.py')
-rw-r--r-- | Lib/idlelib/configHandler.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py index 745d550..a9957c5 100644 --- a/Lib/idlelib/configHandler.py +++ b/Lib/idlelib/configHandler.py @@ -203,9 +203,9 @@ class IdleConf: if userDir != '~': # expanduser() found user home dir if not os.path.exists(userDir): warn = ('\n Warning: os.path.expanduser("~") points to\n '+ - userDir+',\n but the path does not exist.\n') + userDir+',\n but the path does not exist.') try: - sys.stderr.write(warn) + print(warn, file=sys.stderr) except OSError: pass userDir = '~' @@ -218,8 +218,8 @@ class IdleConf: os.mkdir(userDir) except OSError: warn = ('\n Warning: unable to create user config directory\n'+ - userDir+'\n Check path and permissions.\n Exiting!\n\n') - sys.stderr.write(warn) + userDir+'\n Check path and permissions.\n Exiting!\n') + print(warn, file=sys.stderr) raise SystemExit return userDir @@ -244,12 +244,12 @@ class IdleConf: except ValueError: warning = ('\n Warning: configHandler.py - IdleConf.GetOption -\n' ' invalid %r value for configuration option %r\n' - ' from section %r: %r\n' % + ' from section %r: %r' % (type, option, section, self.userCfg[configType].Get(section, option, raw=raw))) try: - sys.stderr.write(warning) + print(warning, file=sys.stderr) except OSError: pass try: @@ -263,10 +263,10 @@ class IdleConf: warning = ('\n Warning: configHandler.py - IdleConf.GetOption -\n' ' problem retrieving configuration option %r\n' ' from section %r.\n' - ' returning default value: %r\n' % + ' returning default value: %r' % (option, section, default)) try: - sys.stderr.write(warning) + print(warning, file=sys.stderr) except OSError: pass return default @@ -375,10 +375,10 @@ class IdleConf: warning=('\n Warning: configHandler.py - IdleConf.GetThemeDict' ' -\n problem retrieving theme element %r' '\n from theme %r.\n' - ' returning default value: %r\n' % + ' returning default value: %r' % (element, themeName, theme[element])) try: - sys.stderr.write(warning) + print(warning, file=sys.stderr) except OSError: pass colour=cfgParser.Get(themeName,element,default=theme[element]) @@ -635,10 +635,10 @@ class IdleConf: warning=('\n Warning: configHandler.py - IdleConf.GetCoreKeys' ' -\n problem retrieving key binding for event %r' '\n from key set %r.\n' - ' returning default value: %r\n' % + ' returning default value: %r' % (event, keySetName, keyBindings[event])) try: - sys.stderr.write(warning) + print(warning, file=sys.stderr) except OSError: pass return keyBindings |