mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-24 14:15:14 +02:00
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:
parent
a2f67febb4
commit
14046705cf
1 changed files with 1 additions and 2 deletions
|
|
@ -13,7 +13,6 @@ except ImportError:
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
from configparser import NoOptionError
|
from configparser import NoOptionError
|
||||||
|
|
||||||
|
|
||||||
# This is the default configuration file that always needs to be present.
|
# 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'))
|
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'))
|
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)
|
# 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')
|
user_file = os.path.join(home,'.config','GPy', 'user.cfg')
|
||||||
|
|
||||||
# Read in the given files.
|
# Read in the given files.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue