Commit 8a48d5fa59535596fe9e4b53f3c1962510c8748e
1 parent
fb6cfc7d
Exists in
master
and in
2 other branches
Make sure spacepy's toolbox is up-to-date BEFORE we try to import pycdf, or it will fail miserably.
Showing
1 changed file
with
5 additions
and
1 deletions
Show diff stats
web/run.py
@@ -1037,7 +1037,6 @@ def download_targets_cdf(targets, inp, started_at, stopped_at): | @@ -1037,7 +1037,6 @@ def download_targets_cdf(targets, inp, started_at, stopped_at): | ||
1037 | log.debug("Creating the CDF file '%s'..." % cdf_filename) | 1037 | log.debug("Creating the CDF file '%s'..." % cdf_filename) |
1038 | environ['SPACEPY'] = CACHE_DIR | 1038 | environ['SPACEPY'] = CACHE_DIR |
1039 | environ['CDF_LIB'] = CDF_LIB | 1039 | environ['CDF_LIB'] = CDF_LIB |
1040 | - from spacepy import pycdf | ||
1041 | try: | 1040 | try: |
1042 | # todo: maybe move this to the daily cache warmup ? | 1041 | # todo: maybe move this to the daily cache warmup ? |
1043 | log.info("Updating spacepy's table of leap seconds…") | 1042 | log.info("Updating spacepy's table of leap seconds…") |
@@ -1046,6 +1045,11 @@ def download_targets_cdf(targets, inp, started_at, stopped_at): | @@ -1046,6 +1045,11 @@ def download_targets_cdf(targets, inp, started_at, stopped_at): | ||
1046 | except Exception as e: | 1045 | except Exception as e: |
1047 | log.error("Failed to update spacepy : %s." % e) | 1046 | log.error("Failed to update spacepy : %s." % e) |
1048 | try: | 1047 | try: |
1048 | + from spacepy import pycdf | ||
1049 | + except ImportError as e: | ||
1050 | + log.error("Failed to import pycdf from spacepy : %s" % e) | ||
1051 | + raise | ||
1052 | + try: | ||
1049 | cdf_handle = pycdf.CDF(cdf_path, masterpath='') | 1053 | cdf_handle = pycdf.CDF(cdf_path, masterpath='') |
1050 | description = "Model and orbit data for %s." % \ | 1054 | description = "Model and orbit data for %s." % \ |
1051 | ', '.join([t['name'] for t in targets_configs]) | 1055 | ', '.join([t['name'] for t in targets_configs]) |