diff --git a/jinja2_renderer.go b/jinja2_renderer.go index 1d29550..604775a 100644 --- a/jinja2_renderer.go +++ b/jinja2_renderer.go @@ -58,6 +58,13 @@ func newPythonJinja2Renderer(j2 *Jinja2) (*pythonJinja2Renderer, error) { j2r.stdoutReader = bufio.NewReader(j2r.stdout) + _, err = j2r.runCmd(&jinja2Cmd{ + Cmd: "init", + }) + if err != nil { + return nil, fmt.Errorf("failed to initialize renderer: %w", err) + } + isOk = true return j2r, nil diff --git a/python_src/main.py b/python_src/main.py index 4a44db1..a98c242 100644 --- a/python_src/main.py +++ b/python_src/main.py @@ -15,7 +15,9 @@ def main(): r = Jinja2Renderer(opts) result = {} - if cmd["cmd"] == "render-strings": + if cmd["cmd"] == "init": + pass + elif cmd["cmd"] == "render-strings": result = { "templateResults": r.RenderStrings(cmd["templates"]) }