Changes in / [bf94e6e:a0243f7] in sasmodels


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/generate.py

    r6cbdcd4 rf9c8474  
    169169 
    170170import sys 
    171 from os.path import abspath, dirname, join as joinpath, exists, getmtime 
     171from os import environ 
     172from os.path import abspath, dirname, join as joinpath, exists, getmtime, sep 
    172173import re 
    173174import string 
     
    900901        kernel_module = load_custom_kernel_module(model_name) 
    901902    else: 
    902         from sasmodels import models 
    903         __import__('sasmodels.models.'+model_name) 
    904         kernel_module = getattr(models, model_name, None) 
     903        try: 
     904            from sasmodels import models 
     905            __import__('sasmodels.models.'+model_name) 
     906            kernel_module = getattr(models, model_name, None) 
     907        except ImportError: 
     908            # If the model isn't a built in model, try the plugin directory 
     909            plugin_path = environ.get('SAS_MODELPATH', None) 
     910            if plugin_path is not None: 
     911                file_name = model_name.split(sep)[-1] 
     912                model_name = plugin_path + sep + file_name + ".py" 
     913                kernel_module = load_custom_kernel_module(model_name) 
     914            else: 
     915                raise 
    905916    return kernel_module 
    906917 
Note: See TracChangeset for help on using the changeset viewer.