# HG changeset patch # User Goffi # Date 1551599856 -3600 # Node ID 6aa22011bc6d0be0f36b6ab56c7ebee240eb6427 # Parent 6cd3549e8d674f3fa8663b81f33826514c9c1e68 tools (config): log error message if config can't be read diff -r 6cd3549e8d67 -r 6aa22011bc6d sat/tools/config.py --- a/sat/tools/config.py Sat Mar 02 18:43:09 2019 +0100 +++ b/sat/tools/config.py Sun Mar 03 08:57:36 2019 +0100 @@ -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 @@ 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