1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
import os
TEMPLATE_PATH = 'templates/module_execute_tpl.docx'
JSON_PATH = 'templates/module_execute.json'
OUTPUT_FILENAME = 'output/module_execute.docx'
OVERWRITE = '-o'
QUIET = '-q'
if os.path.exists(OUTPUT_FILENAME):
os.unlink(OUTPUT_FILENAME)
os.chdir(os.path.dirname(__file__))
cmd = 'python3 -m docxtpl %s %s %s %s %s' % (TEMPLATE_PATH, JSON_PATH, OUTPUT_FILENAME, OVERWRITE, QUIET)
print('Executing "%s" ...' % cmd)
os.system(cmd)
if os.path.exists(OUTPUT_FILENAME):
print(' --> File %s has been generated.' % OUTPUT_FILENAME)
|