from metadata import version
-def main(template, data={}, **kwargs):
+def main(template, data=None, **kwargs):
with io.open(template, 'r', encoding='utf-8') as template_file:
- if data != {}:
- data_file = io.open(data, 'r', encoding='utf-8')
- data = json.load(data_file)
- data_file.close()
+ if data is not None:
+ with io.open(data, 'r', encoding='utf-8') as data_file:
+ data = json.load(data_file)
+ else:
+ data = {}
args = {
'template': template_file,
sys.stdout.flush()
except SyntaxError as e:
print('Chevron: syntax error')
- print(' ' + '\n '.join(e.args[0].split('\n')))
- exit(1)
+ sys.exit(' ' + '\n '.join(e.args[0].split('\n')))
if __name__ == '__main__':