tools (config): log error message if config can't be read
This commit is contained in:
parent
ef702b8a75
commit
9a0218ea10
1 changed files with 8 additions and 11 deletions
|
|
@ -20,20 +20,17 @@
|
|||
|
||||
""" Configuration related useful methods """
|
||||
|
||||
import os
|
||||
import csv
|
||||
import json
|
||||
from ConfigParser import SafeConfigParser, DEFAULTSECT, NoOptionError, NoSectionError
|
||||
from xdg import BaseDirectory
|
||||
from sat.core.log import getLogger
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
from sat.core.constants import Const as C
|
||||
from sat.core.i18n import _
|
||||
from sat.core import exceptions
|
||||
|
||||
from ConfigParser import SafeConfigParser, DEFAULTSECT, NoOptionError, NoSectionError
|
||||
from xdg import BaseDirectory
|
||||
import os
|
||||
import csv
|
||||
import json
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
def fixConfigOption(section, option, value, silent=True):
|
||||
"""Force a configuration option value, writing it in the first found user
|
||||
|
|
@ -77,8 +74,8 @@ def parseMainConf():
|
|||
config = SafeConfigParser(defaults=C.DEFAULT_CONFIG)
|
||||
try:
|
||||
config.read(C.CONFIG_FILES)
|
||||
except:
|
||||
log.error(_("Can't read main config !"))
|
||||
except Exception as e:
|
||||
log.error(_(u"Can't read main config: {msg}").format(msg=e))
|
||||
return config
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue