Mercurial > pylearn
changeset 655:14d22ca1c8b5
if PYLEARN_DATA_ROOT don't exist try DBPATH.
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Fri, 13 Feb 2009 13:22:26 -0500 |
parents | 2704c8688ced |
children | 4837aee22352 |
files | pylearn/datasets/config.py |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/pylearn/datasets/config.py Wed Feb 11 01:43:14 2009 -0500 +++ b/pylearn/datasets/config.py Fri Feb 13 13:22:26 2009 -0500 @@ -5,12 +5,14 @@ """ import os, sys -def env_get(key, default): +def env_get(key, default, key2 = None): + if key2 and os.getenv(key) is None: + key=key2 if os.getenv(key) is None: print >> sys.stderr, "WARNING: Environment variable", key, print >> sys.stderr, "is not set. Using default of", default return default if os.getenv(key) is None else os.getenv(key) def data_root(): - return env_get('PYLEARN_DATA_ROOT', os.getenv('HOME')+'/data') + return env_get('PYLEARN_DATA_ROOT', os.getenv('HOME')+'/data', 'DBPATH')