Changeset 2a8b4756 in sasview for sasview/logger_config.py


Ignore:
Timestamp:
Apr 10, 2017 10:21:10 AM (7 years ago)
Author:
Ricardo Ferraz Leal <ricleal@…>
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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
0505fce
Parents:
c04fb72
Message:

fixing package resources for OSx

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasview/logger_config.py

    rc04fb72 r2a8b4756  
    5656        ''' 
    5757        ''' 
    58         for filepath in [ 
    59                 os.path.join(os.path.abspath(os.path.dirname(__file__)), filename), 
    60                 pkg_resources.resource_filename(__name__, filename), 
    61             ]: 
     58        places_to_look_for_conf_file = [ 
     59            os.path.join(os.path.abspath(os.path.dirname(__file__)), filename), 
     60            os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", filename), 
     61            os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", "..", filename), 
     62        ] 
     63 
     64        # To avoid the exception in OSx 
     65        # NotImplementedError: resource_filename() only supported for .egg, not .zip 
     66        try: 
     67            places_to_look_for_conf_file.append( 
     68                pkg_resources.resource_filename(__name__, filename)) 
     69        except NotImplementedError: 
     70            pass 
     71 
     72        for filepath in places_to_look_for_conf_file: 
    6273            if os.path.exists(filepath): 
    6374                self.config_file = filepath 
Note: See TracChangeset for help on using the changeset viewer.