My desktop is GNOME and I am programmatically changing its settings via Python.
The database has simple value types, e.g. strings, ints, lists of strings, list of ints, ...
A simple CLI tool to manipulate the data is gconftool-2, which returns values for keys using the --get
option.
I don't know to to infer the type from these values considering that I need to know the value when setting it back to something. Notice, in my schema, "8" is a string and 8 is an int, but they are both output as just 8 by gconftool-2.
How would you go about doing this?
Rather than invoking the command line tool, try using the
gconf
module included in the GNOME Python bindings:For lists, you can introspect the list value type:
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
andClient.set_string
).