Did I find the right examples for you? yes no

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
Search for a configuration file in current, user home or /etc (not suitable for windows...) folders

        def get_config(appname="wstunneld", filename="wstunneld.yml"):
    """
    Search for a configuration file in current, user home or /etc (not suitable for windows...) folders
    """
    path_list = [os.getcwd(),
                 os.path.join(os.path.expanduser("~"), "." + appname),
                 os.path.join("/etc", appname)]

    for conf_dir in path_list:
        if conf_dir:
            conf_file = os.path.join(conf_dir, filename)
            if os.path.exists(conf_file):
                return conf_file
    return None
        


src/w/s/wstunnel-0.0.3/wstunnel/daemon/wstunsrvd.py   wstunnel(Download)
import yaml
from wstunnel.daemon import WSTunnelServerDaemon
from wstunnel.toolbox import get_config
 
__author__ = "fabio"
                        metavar="CONF_FILE",
                        help="path to a configuration file",
                        default=get_config("wstunneld", "wstunsrvd.yml"))
    # parser.add_argument("-p", "--pid-file",
    #                     metavar="PID_FILE",

src/w/s/wstunnel-0.0.3/wstunnel/daemon/wstuncltd.py   wstunnel(Download)
import yaml
from wstunnel.daemon import WSTunnelClientDaemon
from wstunnel.toolbox import get_config
 
__author__ = "fabio"
                        metavar="CONF_FILE",
                        help="path to a configuration file",
                        default=get_config("wstunneld", "wstuncltd.yml"))
    # parser.add_argument("-p", "--pid-file",
    #                     metavar="PID_FILE",