summaryrefslogtreecommitdiff
path: root/examples/read_conf.py
blob: bbee83bc52b562845cd725b71bdc4b1b490bf778 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 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.location('file-extensions'))
except pom_parser.Error as e:
	print('Parse error:', str(e), sep = '\n')