From 00a823ef7e18fc2841408155faffea9732c83d8b 2009-11-09 04:47:53 From: Brian Granger Date: 2009-11-09 04:47:53 Subject: [PATCH] Fixing two bugs in the handling of paths and profiles. * If a user is using a profile, but doesn't have the subconfig installed we just pass silently. Before, we raised an IOError. * My new expand_path function had a stupid bug in it. --- diff --git a/IPython/config/loader.py b/IPython/config/loader.py index 9be41fb..e8bb620 100644 --- a/IPython/config/loader.py +++ b/IPython/config/loader.py @@ -244,8 +244,14 @@ class PyFileConfigLoader(FileConfigLoader): # with the parents. def load_subconfig(fname): loader = PyFileConfigLoader(fname, self.path) - sub_config = loader.load_config() - self.config._merge(sub_config) + try: + sub_config = loader.load_config() + except IOError: + # Pass silently if the sub config is not there. This happens + # when a user us using a profile, but not the default config. + pass + else: + self.config._merge(sub_config) # Again, this needs to be a closure and should be used in config # files to get the config being loaded. diff --git a/IPython/utils/genutils.py b/IPython/utils/genutils.py index 180c7c5..0a81348 100644 --- a/IPython/utils/genutils.py +++ b/IPython/utils/genutils.py @@ -1754,11 +1754,11 @@ def expand_path(s): # alone an empty var. But, we need the $ to remains there (it indicates # a hidden share). if os.name=='nt': - s.replace('$\\', 'IPYTHON_TEMP') - s2 = os.path.expandvars(os.path.expanduser(s)) + s = s.replace('$\\', 'IPYTHON_TEMP') + s = os.path.expandvars(os.path.expanduser(s)) if os.name=='nt': - s2.replace('IPYTHON_TEMP', '$\\') - return s2 + s = s.replace('IPYTHON_TEMP', '$\\') + return s def list_strings(arg): """Always return a list of strings, given a string or list of strings