Changeset 248 for CCCC


Ignore:
Timestamp:
29/10/14 16:02:30 (6 years ago)
Author:
mjuckes
Message:

Improved robustness of netcdf library selection -- testing import

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CCCC/trunk/ceda_cc/file_utils.py

    r212 r248  
    1919for x in supportedNetcdf: 
    2020  if x in ll: 
    21     installedSupportedNetcdf.append( x ) 
     21    if len(installedSupportedNetcdf) == 0: 
     22      try:  
     23        cmd = 'import %s' % x 
     24        print '>>>>>>>>>', cmd 
     25        exec cmd 
     26        installedSupportedNetcdf.append( x ) 
     27      except: 
     28        print 'Failed to install %s' % x 
     29    else: 
     30      installedSupportedNetcdf.append( x ) 
    2231 
    2332if len(installedSupportedNetcdf) > 0: 
    24   try:  
    25     cmd = 'import %s' % installedSupportedNetcdf[0] 
    26     print '>>>>>>>>>', cmd 
    27     exec cmd 
    28     ncLib = installedSupportedNetcdf[0] 
    29   except: 
    30     print 'Failed to install %s' % installedSupportedNetcdf[0] 
    31     ncLib = None 
     33  ncLib = installedSupportedNetcdf[0] 
    3234else: 
    3335  print """No supported netcdf module found. 
Note: See TracChangeset for help on using the changeset viewer.