Mercurial > libervia-backend
changeset 2835:6aa22011bc6d
tools (config): log error message if config can't be read
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 03 Mar 2019 08:57:36 +0100 (2019-03-03) |
parents | 6cd3549e8d67 |
children | ad00f61fd9f5 |
files | sat/tools/config.py |
diffstat | 1 files changed, 8 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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