Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create an app with Quickly but i have a question: Lots of applications create config files under ~/.config or ~/.application/config in home folder of current user and keep configs, user settings in that files. Applications use that config files for next run. I can use gsettings for app's configurations but i want to create a config text file and use it. How can i do this with ubuntu Quickly application template? I took a look to ~/myapp/myapp_lib/ and ~/myapp/myapp_lib/ but could not find any solution. Thanks

share|improve this question
up vote 2 down vote accepted

Quickly doesn't offer any helpers to set up a text config file, you'll have to do that yourself. GLib give you an easy way to get the user config directory, GLib.get_user_config_dir() and you can use ConfigParser to handle the file itself.

Something like so:

from gi.repository import GLib
import ConfigParser


    confDir =  os.path.join(GLib.get_user_config_dir(), 'myapp/')
    confFile = os.path.join(confDir + "conf.ini")
    config = ConfigParser.ConfigParser()

    if os.path.isfile(confFile):
        some_setting = config.get('Some Section', 'some_setting')
        if not os.path.exists(confDir):
        config.add_section('Some Section')
        config.set('Some Section', 'some_setting', 'some_value')
        with open(confFile, 'wb') as confFile:
share|improve this answer
Thanks! ConfigParser works for me :) – mnrl Aug 22 '13 at 19:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.