config/printconfigsetting.py
author reed@reedloden.com
Tue, 29 Jan 2008 10:38:15 -0800
changeset 10924 c240b3f25bb784ee39ab1baf99e7fcd12077be68
parent 2752 bb06c19d18c043e1b2c66aeffb3b1e33205f7378
child 98983 f4157e8c410708d76703f19e4dfb61859bfe32d8
permissions -rw-r--r--
Bug 66057 - "Proxy: $http_proxy should influence proxy settings" [p=roc@ocallahan.org (Robert O'Callahan [roc]) / diane@ghic.org (Diane Trout) / ventnor.bugzilla@yahoo.com.au (Michael Ventnor) r=josh r+sr=biesi a1.9=damons]

import configobj, sys

try:
    (file, section, key) = sys.argv[1:]
except ValueError:
    print "Usage: printconfigsetting.py <file> <section> <setting>"
    sys.exit(1)

c = configobj.ConfigObj(file)

try:
    s = c[section]
except KeyError:
    print >>sys.stderr, "Section [%s] not found." % section
    sys.exit(1)

try:
    print s[key]
except KeyError:
    print >>sys.stderr, "Key %s not found." % key
    sys.exit(1)