From 14046705cf84f1e05501ef8215043773615731e4 Mon Sep 17 00:00:00 2001 From: Safrone Date: Mon, 9 Jan 2017 04:50:29 -0500 Subject: [PATCH] fix: fallback for when no environment variables are set (#467) * fix: dev: add or in home directory getting adds another or when getting the home directory with os.getenv() so that if neither $HOME nor $USERPROFILE environment variable is set, os.path.join() will not fail by getting a None and the config will revert to the default configuration file. * fix: remove extra statement --- GPy/util/config.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/GPy/util/config.py b/GPy/util/config.py index 53675efe..c6e09e1a 100644 --- a/GPy/util/config.py +++ b/GPy/util/config.py @@ -13,7 +13,6 @@ except ImportError: config = configparser.ConfigParser() from configparser import NoOptionError - # 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')) @@ -22,7 +21,7 @@ default_file = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', ' local_file = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'installation.cfg')) # This specifies configurations specific to the user (it is found in the user home directory) -home = os.getenv('HOME') or os.getenv('USERPROFILE') +home = os.getenv('HOME') or os.getenv('USERPROFILE') or '' user_file = os.path.join(home,'.config','GPy', 'user.cfg') # Read in the given files.