예제 #1
0
    def load_config_file(self, suppress_errors=True):
        """Load the config file.

        By default, errors in loading config are handled, and a warning
        printed on screen. For testing, the suppress_errors option is set
        to False, so errors will make tests fail.
        """
        base_config = 'ipython_config.py'
        self.log.debug("Attempting to load config file: %s" % base_config)
        try:
            Application.load_config_file(
                self, base_config, path=self.config_file_paths)
        except IOError:
            # ignore errors loading parent
            pass
        if self.config_file_name == base_config:
            # don't load secondary config
            return
        self.log.debug(
            "Attempting to load config file: %s" % self.config_file_name)
        try:
            Application.load_config_file(
                self, self.config_file_name, path=self.config_file_paths)
        except IOError:
            # Only warn if the default config file was NOT being used.
            if self.config_file_specified:
                self.log.warn("Config file not found, skipping: %s" %
                              self.config_file_name)
        except:
            # For testing purposes.
            if not suppress_errors:
                raise
            self.log.warn(
                "Error loading config file: %s" % self.config_file_name,
                exc_info=True)
예제 #2
0
    def load_config_file(self, suppress_errors=True):
        """Load the config file.

        By default, errors in loading config are handled, and a warning
        printed on screen. For testing, the suppress_errors option is set
        to False, so errors will make tests fail.
        """
        self.log.debug("Searching path %s for config files", self.config_file_paths)
        base_config = "ipython_config.py"
        self.log.debug("Attempting to load config file: %s" % base_config)
        try:
            Application.load_config_file(self, base_config, path=self.config_file_paths)
        except ConfigFileNotFound:
            # ignore errors loading parent
            self.log.debug("Config file %s not found", base_config)
            pass

        for config_file_name in self.config_files:
            if not config_file_name or config_file_name == base_config:
                continue
            self.log.debug("Attempting to load config file: %s" % self.config_file_name)
            try:
                Application.load_config_file(self, config_file_name, path=self.config_file_paths)
            except ConfigFileNotFound:
                # Only warn if the default config file was NOT being used.
                if config_file_name in self.config_file_specified:
                    msg = self.log.warn
                else:
                    msg = self.log.debug
                msg("Config file not found, skipping: %s", config_file_name)
            except:
                # For testing purposes.
                if not suppress_errors:
                    raise
                self.log.warn("Error loading config file: %s" % self.config_file_name, exc_info=True)
예제 #3
0
    def load_config_file(self, profile_name):
        """load a config file from the config file dir

        profile_name : {string} name of the profile file to load without file extension.
        """
        try:
            Application.load_config_file(self, profile_name + ".nbcv", path=[os.path.join(os.getcwdu(), "profile")])
            return True
        except ConfigFileNotFound:
            self.log.warn("Config file for profile '%s' not found, giving up ", profile_name)
            return False
예제 #4
0
    def load_config_file(self, profile_name):
        """load a config file from the config file dir

        profile_name : {string} name of the profile file to load without file extension.
        """
        try:
            Application.load_config_file(
                self,
                profile_name + '.nbcv',
                path=[os.path.join(os.getcwdu(), 'profile')])
            return True
        except ConfigFileNotFound:
            self.log.warn("Config file for profile '%s' not found, giving up ",
                          profile_name)
            return False
    def load_config_file(self, suppress_errors=True):
        """Load the config file.

        By default, errors in loading config are handled, and a warning
        printed on screen. For testing, the suppress_errors option is set
        to False, so errors will make tests fail.
        """
        self.log.debug("Searching path %s for config files", self.config_file_paths)
        base_config = 'ipython_config.py'
        self.log.debug("Attempting to load config file: %s" %
                       base_config)
        try:
            Application.load_config_file(
                self,
                base_config,
                path=self.config_file_paths
            )
        except ConfigFileNotFound:
            # ignore errors loading parent
            self.log.debug("Config file %s not found", base_config)
            pass
        
        for config_file_name in self.config_files:
            if not config_file_name or config_file_name == base_config:
                continue
            self.log.debug("Attempting to load config file: %s" %
                           self.config_file_name)
            try:
                Application.load_config_file(
                    self,
                    config_file_name,
                    path=self.config_file_paths
                )
            except ConfigFileNotFound:
                # Only warn if the default config file was NOT being used.
                if config_file_name in self.config_file_specified:
                    msg = self.log.warn
                else:
                    msg = self.log.debug
                msg("Config file not found, skipping: %s", config_file_name)
            except:
                # For testing purposes.
                if not suppress_errors:
                    raise
                self.log.warn("Error loading config file: %s" %
                              self.config_file_name, exc_info=True)
예제 #6
0
    def load_config_file(self, suppress_errors=True):
        """Load the config file.

        By default, errors in loading config are handled, and a warning
        printed on screen. For testing, the suppress_errors option is set
        to False, so errors will make tests fail.
        """
        base_config = 'ipython_config.py'
        self.log.debug("Attempting to load config file: %s" % base_config)
        try:
            Application.load_config_file(self,
                                         base_config,
                                         path=self.config_file_paths)
        except IOError:
            # ignore errors loading parent
            pass
        if self.config_file_name == base_config:
            # don't load secondary config
            return
        self.log.debug("Attempting to load config file: %s" %
                       self.config_file_name)
        try:
            Application.load_config_file(self,
                                         self.config_file_name,
                                         path=self.config_file_paths)
        except IOError:
            # Only warn if the default config file was NOT being used.
            if self.config_file_specified:
                self.log.warn("Config file not found, skipping: %s" %
                              self.config_file_name)
        except:
            # For testing purposes.
            if not suppress_errors:
                raise
            self.log.warn("Error loading config file: %s" %
                          self.config_file_name,
                          exc_info=True)