Show More
@@ -27,7 +27,7 b' from copy import deepcopy' | |||
|
27 | 27 | |
|
28 | 28 | from IPython.config.configurable import SingletonConfigurable |
|
29 | 29 | from IPython.config.loader import ( |
|
30 | KVArgParseConfigLoader, PyFileConfigLoader, Config, ArgumentError | |
|
30 | KVArgParseConfigLoader, PyFileConfigLoader, Config, ArgumentError, ConfigFileNotFound, | |
|
31 | 31 | ) |
|
32 | 32 | |
|
33 | 33 | from IPython.utils.traitlets import ( |
@@ -370,8 +370,8 b' class Application(SingletonConfigurable):' | |||
|
370 | 370 | loader = PyFileConfigLoader(filename, path=path) |
|
371 | 371 | try: |
|
372 | 372 | config = loader.load_config() |
|
373 | except IOError: | |
|
374 |
# problem |
|
|
373 | except ConfigFileNotFound: | |
|
374 | # problem finding the file, raise | |
|
375 | 375 | raise |
|
376 | 376 | except Exception: |
|
377 | 377 | # try to get the full filename, but it will be empty in the |
@@ -34,10 +34,12 b' from IPython.utils import py3compat, text, warn' | |||
|
34 | 34 | class ConfigError(Exception): |
|
35 | 35 | pass |
|
36 | 36 | |
|
37 | ||
|
38 | 37 | class ConfigLoaderError(ConfigError): |
|
39 | 38 | pass |
|
40 | 39 | |
|
40 | class ConfigFileNotFound(ConfigError): | |
|
41 | pass | |
|
42 | ||
|
41 | 43 | class ArgumentError(ConfigLoaderError): |
|
42 | 44 | pass |
|
43 | 45 | |
@@ -258,7 +260,10 b' class PyFileConfigLoader(FileConfigLoader):' | |||
|
258 | 260 | def load_config(self): |
|
259 | 261 | """Load the config from a file and return it as a Struct.""" |
|
260 | 262 | self.clear() |
|
261 | self._find_file() | |
|
263 | try: | |
|
264 | self._find_file() | |
|
265 | except IOError as e: | |
|
266 | raise ConfigFileNotFound(str(e)) | |
|
262 | 267 | self._read_file_as_dict() |
|
263 | 268 | self._convert_to_config() |
|
264 | 269 | return self.config |
@@ -297,7 +302,7 b' class PyFileConfigLoader(FileConfigLoader):' | |||
|
297 | 302 | loader = PyFileConfigLoader(fname, path) |
|
298 | 303 | try: |
|
299 | 304 | sub_config = loader.load_config() |
|
300 |
except |
|
|
305 | except ConfigFileNotFound: | |
|
301 | 306 | # Pass silently if the sub config is not there. This happens |
|
302 | 307 | # when a user s using a profile, but not the default config. |
|
303 | 308 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now