Commit 2fe06b17ffecf8d348c17cb16a799ec05f373a2b

Authored by Goutte
1 parent 129181a6

Move the ENV directives *before* the first try to import spacepy.

Showing 1 changed file with 9 additions and 2 deletions   Show diff stats
web/run.py
... ... @@ -132,6 +132,12 @@ PARAMETERS = {
132 132 }
133 133  
134 134  
  135 +# ENV #########################################################################
  136 +
  137 +environ['SPACEPY'] = CACHE_DIR
  138 +environ['CDF_LIB'] = CDF_LIB
  139 +
  140 +
135 141 # SETUP FLASK ENGINE ##########################################################
136 142  
137 143 app = Flask(__name__, root_path=THIS_DIRECTORY)
... ... @@ -896,8 +902,6 @@ def update_spacepy():
896 902 """
897 903 Importing pydcf will fail if the toolbox is not up to date.
898 904 """
899   - environ['SPACEPY'] = CACHE_DIR
900   - environ['CDF_LIB'] = CDF_LIB
901 905 try:
902 906 log.info("Updating spacepy's toolbox…")
903 907 import spacepy.toolbox
... ... @@ -1233,6 +1237,9 @@ def download_targets_cdf(targets, inp, started_at, stopped_at):
1233 1237 except ImportError as e:
1234 1238 log.error("Failed to import pycdf from spacepy : %s" % e)
1235 1239 raise
  1240 + except Exception as e:
  1241 + log.error("Failed to import pycdf from spacepy : %s" % e)
  1242 + raise
1236 1243  
1237 1244 try:
1238 1245 cdf_handle = pycdf.CDF(cdf_path, masterpath='')
... ...