From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Fri, 10 Feb 2012 21:34:47 +0000 (+0100) Subject: py3k: Fix decoding of default database name in Database._get_user_default_db X-Git-Tag: debian/0.12_rc1-1~101 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=bb514d7862aa38f6628ef1c8cb69ed5ec72098fd py3k: Fix decoding of default database name in Database._get_user_default_db Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de> --- diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index 6238b289..36b65ecb 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -18,6 +18,7 @@ Copyright 2010 Sebastian Spaeth ' """ import os +import codecs from ctypes import c_char_p, c_void_p, c_uint, c_long, byref, POINTER from notmuch.globals import (nmlib, STATUS, NotmuchError, NotInitializedError, NullPointerError, Enum, _str, @@ -553,11 +554,11 @@ class Database(object): config = SafeConfigParser() conf_f = os.getenv('NOTMUCH_CONFIG', os.path.expanduser('~/.notmuch-config')) - config.read(conf_f) + config.readfp(codecs.open(conf_f, 'r', 'utf-8')) if not config.has_option('database', 'path'): raise NotmuchError(message="No DB path specified" " and no user default found") - return config.get('database', 'path').decode('utf-8') + return config.get('database', 'path') @property def db_p(self):