michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: import configobj, sys michael@0: michael@0: try: michael@0: (file, section, key) = sys.argv[1:] michael@0: except ValueError: michael@0: print "Usage: printconfigsetting.py
" michael@0: sys.exit(1) michael@0: michael@0: c = configobj.ConfigObj(file) michael@0: michael@0: try: michael@0: s = c[section] michael@0: except KeyError: michael@0: print >>sys.stderr, "Section [%s] not found." % section michael@0: sys.exit(1) michael@0: michael@0: try: michael@0: print s[key] michael@0: except KeyError: michael@0: print >>sys.stderr, "Key %s not found." % key michael@0: sys.exit(1)