Changeset 5af6f58 in sasview


Ignore:
Timestamp:
Apr 8, 2017 7:31:56 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:
38beeab
Parents:
9c923a3
Message:

Solved file problem for py2exe?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasview/sasview.py

    r9c923a3 r5af6f58  
    1212################################################################################ 
    1313import os 
     14import os.path 
    1415import sys 
    1516import logging 
     
    1920logger = logging.getLogger(__name__) 
    2021if not logger.root.handlers: 
    21     LOGGER_CONFIG_FILE = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'logging.ini') 
     22    # Scripts running under py2exe do not have a __file__ global. Detect this and use sys.argv[0] instead. 
     23    try: 
     24        LOGGER_CONFIG_FILE = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'logging.ini') 
     25    except NameError:  # We are the main py2exe script, not a module 
     26        LOGGER_CONFIG_FILE = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), 'logging.ini') 
    2227    logging.config.fileConfig(LOGGER_CONFIG_FILE, disable_existing_loggers=False) 
    2328    logging.captureWarnings(True) 
Note: See TracChangeset for help on using the changeset viewer.