File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -137,13 +137,19 @@ def loadini(struct, configfile):
137137 in iteritems (defaults ['keyboard' ]))
138138
139139 fill_config_with_default_values (config , defaults )
140- if not config .read (config_path ):
141- # No config file. If the user has it in the old place then complain
142- if os .path .isfile (os .path .expanduser ('~/.bpython.ini' )):
143- sys .stderr .write ("Error: It seems that you have a config file at "
144- "~/.bpython.ini. Please move your config file to "
145- "%s\n " % default_config_path ())
146- sys .exit (1 )
140+ try :
141+ if not config .read (config_path ):
142+ # No config file. If the user has it in the old place then complain
143+ if os .path .isfile (os .path .expanduser ('~/.bpython.ini' )):
144+ sys .stderr .write ("Error: It seems that you have a config file at "
145+ "~/.bpython.ini. Please move your config file to "
146+ "%s\n " % default_config_path ())
147+ sys .exit (1 )
148+ except UnicodeDecodeError as e :
149+ sys .stderr .write ("Error: Unable to parse config file at '{}' due to an "
150+ "encoding issue. Please make sure to fix the encoding "
151+ "of the file or remove it and then try again.\n " .format (config_path ))
152+ sys .exit (1 )
147153
148154 def get_key_no_doublebind (command ):
149155 default_commands_to_keys = defaults ['keyboard' ]
You can’t perform that action at this time.
0 commit comments