<commit_before>import logging
import os
from ConfigParser import SafeConfigParser
from ConfigParser import NoOptionError

class GCConfig(SafeConfigParser):
  _error_messages = []

  def __init__(self):
    SafeConfigParser.__init__(self)

    conf_file = os.path.expanduser('~/.glaciercmd')
    if os.path.isfile(conf_file):
      self.read(conf_file)
    else:
      self._error_messages.append("Could not locate the .glaciercmd configuration file.")

  def has_errors(self):
    required_options = ['aws_key', 'aws_secret']

    for required_option in required_options:
      try:
        self.get('configuration', required_option)
      except NoOptionError:
        self._error_messages.append("The configuration key '{0}' was not found in the configuration file.".format(required_option))

    return len(self._error_messages) > 0

  def log_errors(self):
    for error_message in self._error_messages:
      logging.error(error_message)<commit_msg>Catch error when section doesn't exist.<commit_after>import logging
import os
from ConfigParser import SafeConfigParser
from ConfigParser import NoOptionError
from ConfigParser import NoSectionError

class GCConfig(SafeConfigParser):
  _error_messages = []

  def __init__(self):
    SafeConfigParser.__init__(self)

    conf_file = os.path.expanduser('~/.glaciercmd')
    if os.path.isfile(conf_file):
      self.read(conf_file)
    else:
      self._error_messages.append("Could not locate the .glaciercmd configuration file.")

  def has_errors(self):
    required_options = ['aws_key', 'aws_secret']

    for required_option in required_options:
      try:
        self.get('configuration', required_option)
      except NoOptionError:
        self._error_messages.append("The configuration key '{0}' was not found in the configuration file.".format(required_option))
      except NoSectionError:
        self._error_messages.append("The configuration section was not found in the configuration file.")
        break

    return len(self._error_messages) > 0

  def log_errors(self):
    for error_message in self._error_messages:
      logging.error(error_message)
{'fraction_non_alphanumeric': 0.08761186999528968, 'fraction_numerical': 0.0018841262364578427, 'mean_word_length': 4.118072289156626, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2812009', 'n_tokens_mistral': 602, 'n_tokens_neox': 585, 'n_words': 153}