Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
Get user config filename.

It will return operating system dependent config filename.

Parameters
----------
appname : string
    An application name used for filename

Returns(more...)

        def get_user_config_filename(appname='notify'):
    """
    Get user config filename.

    It will return operating system dependent config filename.

    Parameters
    ----------
    appname : string
        An application name used for filename

    Returns
    -------
    string
        A filename of user configuration.

    """
    import platform
    system = platform.system()
    if system == 'Windows':
        rootname = os.path.join(os.environ['APPDATA'], appname)
        filename = appname + ".cfg"
        prefix = ''
    elif system == 'Linux':
        XDG_CONFIG_HOME = os.environ.get('XDG_CONFIG_HOME', None)
        rootname = XDG_CONFIG_HOME or os.path.join('~', '.config')
        rootname = os.path.expanduser(rootname)
        # check if XDG_CONFIG_HOME exists
        if not os.path.exists(rootname) and XDG_CONFIG_HOME is None:
            # XDG_CONFIG_HOME is not used
            rootname = os.path.expanduser('~')
            filename = appname + ".cfg"
            prefix = '.'
        else:
            rootname = os.path.join(rootname, appname)
            filename = appname + ".cfg"
            prefix = ''
    elif system == 'Darwin':
        rootname = os.path.expanduser('~')
        filename = appname + ".cfg"
        prefix = '.'
    else:
        # Unknown
        rootname = os.path.expanduser('~')
        filename = appname + ".cfg"
        prefix = ''
    return os.path.join(rootname, prefix + filename)
        


src/n/o/notify-0.2.0/src/notify/wizard.py   notify(Download)
    import os
    import codecs
    from notify.conf import get_user_config_filename
    filename = get_user_config_filename()
    if not os.path.exists(os.path.dirname(filename)):

src/n/o/notify-0.2.0/src/notify/compat.py   notify(Download)
    import os
    from notify.utils.plaintext_keyring import PlaintextKeyring
    from notify.conf import get_user_config_filename
    filename = os.path.splitext(get_user_config_filename())[0]
    filename = filename + ".keyring"