Rather than invoking the command line tool, try using the gconf
module included in the GNOME Python bindings:
>>> import gconf
>>> client = gconf.Client()
>>> # Get a value and introspect its type:
>>> value = client.get('/apps/gnome-terminal/profiles/Default/background_color')
>>> value.type
<enum GCONF_VALUE_STRING of type GConfValueType>
>>> value.get_string()
'#FFFFFFFFDDDD'
For lists, you can introspect the list value type:
>>> value = client.get('/apps/compiz-1/general/screen0/options/active_plugins')
>>> value.type
<enum GCONF_VALUE_LIST of type GConfValueType>
>>> value.get_list_type()
<enum GCONF_VALUE_STRING of type GConfValueType>
>>> value.get_list()
(<GConfValue at 0x159aa80>, <GConfValue at 0x159aaa0>, ...)
In general though, you should know the types of the keys you're manipulating and use the appropriate type specific access methods directly (e.g. Client.get_string
and Client.set_string
).