Hi,
Sind die execPython-Sektionen noch aktuell mit Unterstützung von Python 3? Das Beispiel im Handbuch sieht mir arg nach Python3 aus.
Viele Grüße,
Stefan
execPython Python3?
Re: execPython Python3?
Hallo Stefan,
verwende bitte dafür die verallgemeinerte execWith Sektion:
ExecWith_SECTION PROGRAM PROGRAMPARAS pass PASSPARAS winst WINSTOPTS
Details im Handbuch
Grüße Jan
verwende bitte dafür die verallgemeinerte execWith Sektion:
ExecWith_SECTION PROGRAM PROGRAMPARAS pass PASSPARAS winst WINSTOPTS
Details im Handbuch
Grüße Jan
Re: execPython Python3?
Danke funktioniert. Hier ein Beispiel mit jinja-Templating:
Code: Alles auswählen
execWith_jinja_template "python3"
if not("0" = getLastExitCode)
Message "failed execWith_jinja_template"
LogError "failed execWith_jinja_template"
isFatalError "execWith_jinja_template"
endif
[execWith_jinja_tepmlplate]
import pathlib
from jinja2 import Environment, FileSystemLoader, select_autoescape
env = Environment(loader=FileSystemLoader("%ScriptPath%"))
template = env.get_template("tepmplatename.template")
output = template.render(bla="$bla$", blub="blub")
cfile = pathlib.Path("/path/to/configfile.conf")
cfile.write_text(output)