summaryrefslogtreecommitdiff
path: root/examples/read_conf.py
blob: f8ce8b97779d8e07b147c0303a58605c9dfd7abe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Put root of repository in sys.path
# (Ordinarily you won't want to do this — this is only
#  needed to make this example work without pom_parser installed.)
from pathlib import Path
import sys
sys.path.append(str(Path(__file__).parent.parent))

import pom_parser
try:
	filename = 'examples/conf.pom' if len(sys.argv) < 2 else sys.argv[1]
	conf = pom_parser.load_path(filename)
	print(conf.get('indentation-type','hafkjd'))
	print(conf.section('plug-in'))
except pom_parser.Error as e:
	print('Parse error:', str(e), sep = '\n')