From afd92820f72d4083dc4146ced5f5491ab8a6b1c6 Mon Sep 17 00:00:00 2001 From: Mike Croucher Date: Fri, 27 Feb 2015 07:59:54 +0000 Subject: [PATCH] Fixed ConfigParser for Python 3 compat --- GPy/util/config.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/GPy/util/config.py b/GPy/util/config.py index 8496fe36..312d6991 100644 --- a/GPy/util/config.py +++ b/GPy/util/config.py @@ -1,9 +1,18 @@ # # This loads the configuration # -import ConfigParser import os -config = ConfigParser.ConfigParser() +try: + #Attempt Python 2 ConfigParser setup + import ConfigParser + config = ConfigParser.ConfigParser() +except ImportError: + #Attempt Python 3 ConfigParser setup + import configparser + config = configparser.ConfigParser() + + + # This is the default configuration file that always needs to be present. default_file = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'defaults.cfg'))