Changeset c6bdb3b in sasview for src/sas/sasgui/__init__.py
- Timestamp:
- May 2, 2017 10:03:50 PM (8 years ago)
- 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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- a67ec83
- Parents:
- 7c105e8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/__init__.py
r914ba0a rc6bdb3b 47 47 48 48 def get_app_dir(): 49 if APP_FOLDER is None:50 raise RuntimeError("Need to initialize sas.sasgui.USER_FOLDER")51 49 return APP_FOLDER 52 50 53 51 def get_user_dir(): 54 if USER_FOLDER is None:55 raise RuntimeError("Need to initialize sas.sasgui.USER_FOLDER")56 52 return USER_FOLDER 57 53 … … 74 70 import os 75 71 import sys 76 import imp77 72 import logging 73 from sasmodels.custom import load_module_from_path 78 74 79 75 logger = logging.getLogger(__name__) … … 81 77 filename = 'local_config.py' 82 78 path = os.path.join(dirname, filename) 83 if os.path.exists(path): 84 try: 85 fObj = None 86 fObj, config_path, descr = imp.find_module('local_config', [APP_FOLDER]) 87 config = imp.load_module('local_config', fObj, config_path, descr) 88 logger.info("GuiManager loaded %s" % config_path) 89 return config 90 except Exception: 91 import traceback; logger.error(traceback.format_exc()) 92 logger.error("Error loading %s: %s" % (path, sys.exc_value)) 93 finally: 94 if fObj is not None: 95 fObj.close() 96 from sas.sasgui.guiframe import config 97 logger.info("GuiManager config defaults to sas.sasgui.guiframe") 98 return config 99 79 try: 80 module = load_module_from_path('sas.sasgui.local_config', path) 81 logger.info("GuiManager loaded %s", path) 82 return module 83 except Exception as exc: 84 logger.critical("Error loading %s: %s", path, exc) 85 sys.exit()
Note: See TracChangeset
for help on using the changeset viewer.