Changeset bfcae3c in sasview for sansguiframe


Ignore:
Timestamp:
Dec 15, 2011 12:52:40 PM (13 years ago)
Author:
Mathieu Doucet <doucetm@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
5376e03
Parents:
ac2ceb9b
Message:

Re #3 improve finding algo for config

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansguiframe/src/sans/guiframe/gui_manager.py

    rcb8a972 rbfcae3c  
    4242from sans.dataloader.loader import Loader 
    4343 
    44 DATAPATH = os.getcwd()   
    45 PATH_APP = os.getcwd() 
     44from sans import sansview 
     45PATH_APP = os.path.dirname(sansview.__file__) 
     46DATAPATH = PATH_APP 
    4647 
    4748def _find_local_config(file, path): 
    4849    """ 
    49     Find configuration file for the current application 
    50     """ 
    51      
    52     file_path = os.path.abspath(os.path.join(path, "%s.py" % file)) 
    53     if(os.path.isfile(file_path)): 
    54         py_compile.compile(file=file_path) 
     50        Find configuration file for the current application 
     51    """     
     52    config_module = None 
     53    try: 
    5554        fObj, path_config, descr = imp.find_module(file, [path]) 
    56         try: 
    57             return imp.load_module(file, fObj, path_config, descr)  
    58         except: 
    59             raise 
    60         finally: 
    61             if fObj: 
    62                 fObj.close() 
    63          
     55        config_module = imp.load_module(file, fObj, path_config, descr)  
     56    except: 
     57        pass 
     58    finally: 
     59        if fObj: 
     60            fObj.close() 
     61    return config_module 
    6462               
    6563try: 
Note: See TracChangeset for help on using the changeset viewer.