diff options
Diffstat (limited to 'src/msec/config.py')
-rwxr-xr-x | src/msec/config.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/msec/config.py b/src/msec/config.py index b4466ed..8bbcf86 100755 --- a/src/msec/config.py +++ b/src/msec/config.py @@ -180,16 +180,8 @@ def to_utf8(s): return str(s).decode("utf-8") def Narg(s): - """ Returs string after decoding if needed """ - try: - s.decode() - return s - except: - try: - t=str(s) - except: - return s - return t.decode(SYS_ENC) + """ Returns string after decoding if needed. It seems to be no more need in Python 3 """ + return s # {{{ MsecConfig class MsecConfig: @@ -231,7 +223,7 @@ class MsecConfig: try: fd = open(self.config) except: - self.log.error(_("Unable to load configuration file %s: %s") % (self.config, Narg(sys.exc_value[1]))) + self.log.error(_("Unable to load configuration file %s: %s") % (self.config, Narg(sys.exc_info()[1]))) return False for line in fd.readlines(): line = line.strip() @@ -339,7 +331,7 @@ class ExceptionConfig: fd = open(self.config) except: # this file is optional, so if it is not found that's not fatal - self.log.info(_("loading exceptions file %s: %s") % (self.config, Narg(sys.exc_value[1]))) + self.log.info(_("loading exceptions file %s: %s") % (self.config, Narg(sys.exc_info()[1]))) self.log.info(_("No exceptions loaded")) return False for line in fd.readlines(): |