]> git.notmuchmail.org Git - notmuch/blobdiff - bindings/python/notmuch/database.py
py3k: The ConfigParser module has been renamed to configparser
[notmuch] / bindings / python / notmuch / database.py
index 7923f768b1f78caec831c3018b5280367feb9712..93183687a4259c8aebe391ccb342c4b577493366 100644 (file)
@@ -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'))