# Path: astwro/config/logger.py



    from ConfigParser import ConfigParser, NoOptionError, NoSectionError # python 2
    from configparser import ConfigParser, NoOptionError, NoSectionError # python3
from .logger import logger
import os, shutil, multiprocessing, logging
    config = ConfigParser()
    read = config.read(files)
    read.reverse()
    if read:
        logger.info('Using astwro conf files (in priority order):\n\t{}'.format(
            '\n\t'.join(read)))
    else:
        logger.error('No configuration file found.')
    return config


def create_config_file(destpath='.'):
    """Creates sample daophot config file (with default values) in destpath"""
    shutil.copy(os.path.join(get_package_config_path(), 'astwro.cfg'), destpath)


def find_opt_file(filename, package=None, mustexist=True):
    """Searches for opt file (e.g. daophot.opt) in working dir, configuration, default module file"""
    # 1. in local working dir
    if os.path.isfile(filename):
        return filename
    # 2. in config

    filepath = None
    try:
        filepath = get_config().get('files', filename)
    except (NoOptionError, NoSectionError):
        # 3. default file
        filepath = os.path.join(get_package_config_path(package), filename)
        if not os.path.isfile(filepath):

# Path: astwro/config/logger.py



# Path: astwro/config/config.py
    from ConfigParser import ConfigParser, NoOptionError, NoSectionError # python 2
    from configparser import ConfigParser, NoOptionError, NoSectionError # python3
from .logger import logger
import os, shutil, multiprocessing, logging

    config = ConfigParser()
    read = config.read(files)
    read.reverse()
    if read:
        logger.info('Using astwro conf files (in priority order):\n\t{}'.format(
            '\n\t'.join(read)))
    else:
        logger.error('No configuration file found.')
    return config


def create_config_file(destpath='.'):
    """Creates sample daophot config file (with default values) in destpath"""
    shutil.copy(os.path.join(get_package_config_path(), 'astwro.cfg'), destpath)


def find_opt_file(filename, package=None, mustexist=True):
    """Searches for opt file (e.g. daophot.opt) in working dir, configuration, default module file"""
    # 1. in local working dir
    if os.path.isfile(filename):
        return filename
    # 2. in config

    filepath = None
    try:
        filepath = get_config().get('files', filename)
    except (NoOptionError, NoSectionError):
        # 3. default file
        filepath = os.path.join(get_package_config_path(package), filename)
        if not os.path.isfile(filepath):

            logger.log('error' if mustexist else 'debug',