File: module_execute.py

package info (click to toggle)
python-docx-template 0.16.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,296 kB
  • sloc: python: 1,552; makefile: 164
file content (19 lines) | stat: -rw-r--r-- 549 bytes parent folder | download
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)