Bug 1727271: part 3) const-qualify `Document::HasValidTransientUserGestureActivation...
[gecko.git] / config / printconfigsetting.py
blob79b3b4848b47f1b95312d81e2db9a7aea925e92e
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 import sys
7 from configparser import (
8 ConfigParser,
9 NoOptionError,
10 NoSectionError,
13 try:
14 (filename, section, key) = sys.argv[1:]
15 except ValueError:
16 print("Usage: printconfigsetting.py <filename> <section> <setting>")
17 sys.exit(1)
19 cfg = ConfigParser()
20 cfg.read(filename)
22 try:
23 print(cfg.get(section, key))
24 except NoOptionError:
25 print("Key %s not found." % key, file=sys.stderr)
26 sys.exit(1)
27 except NoSectionError:
28 print("Section [%s] not found." % section, file=sys.stderr)
29 sys.exit(1)