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
This commit is contained in:
Safrone 2017-01-09 04:50:29 -05:00 committed by Max Zwiessele
parent a2f67febb4
commit 14046705cf

View file

@ -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.