From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Wed, 14 Dec 2011 10:58:20 +0000 (+0100) Subject: py3k: The ConfigParser module has been renamed to configparser X-Git-Tag: debian/0.12_rc1-1~235 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=4ed0362d41e62d5254be6cfb46e0c0c9fd9de0a0 py3k: The ConfigParser module has been renamed to configparser --- diff --git a/bindings/python/notmuch.py b/bindings/python/notmuch.py index 8d118595..3ff53ec8 100755 --- a/bindings/python/notmuch.py +++ b/bindings/python/notmuch.py @@ -17,7 +17,12 @@ import stat import email from notmuch import Database, Query, NotmuchError, STATUS -from ConfigParser import SafeConfigParser +try: + # python3.x + from configparser import SafeConfigParser +except ImportError: + # python2.x + from ConfigParser import SafeConfigParser from cStringIO import StringIO PREFIX = re.compile('(\w+):(.*$)') diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index 7923f768..93183687 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -543,7 +543,13 @@ class Database(object): """ Reads a user's notmuch config and returns his db location Throws a NotmuchError if it cannot find it""" - from ConfigParser import SafeConfigParser + try: + # python3.x + from configparser import SafeConfigParser + except ImportError: + # python2.x + from ConfigParser import SafeConfigParser + config = SafeConfigParser() conf_f = os.getenv('NOTMUCH_CONFIG', os.path.expanduser('~/.notmuch-config'))