changeset 653:d3d8f5a17909

print warning on undefined PYLEARN_DATA_ROOT
author bergstra@mlp4.ais.sandbox
date Wed, 11 Feb 2009 01:42:58 -0500
parents 37a259d6946a
children 2704c8688ced
files pylearn/datasets/MNIST.py pylearn/datasets/config.py
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/datasets/MNIST.py	Wed Feb 11 01:42:26 2009 -0500
+++ b/pylearn/datasets/MNIST.py	Wed Feb 11 01:42:58 2009 -0500
@@ -7,7 +7,7 @@
 import numpy
 
 from ..io.amat import AMat
-from .config import data_root
+from .config import data_root # config
 from .dataset import Dataset
 
 def head(n=10, path=None):
--- a/pylearn/datasets/config.py	Wed Feb 11 01:42:26 2009 -0500
+++ b/pylearn/datasets/config.py	Wed Feb 11 01:42:58 2009 -0500
@@ -4,10 +4,13 @@
 Especially, the locations of data files.
 """
 
-import os
+import os, sys
 def env_get(key, default):
+    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', '/u/bergstrj/pub/data/')
+    return env_get('PYLEARN_DATA_ROOT', os.getenv('HOME')+'/data')