I would like to write a python script to automate the conversion of libreoffice ott templates to normal odt files. if I go to the terminal (bash shell) and I type:
soffice --headless --convert-to odt "/path/template.ott" --outdir '/targetpath/template.odt'
The output is as expected, an odt file in a new target location.
When I script it (like so:
oldfile
outdir = pipes.quote(/targetpath/template.odt)
subprocess.call(['soffice --headless --convert-to odt /path/template.ott --outdir /pathtarget/template.odt'])
the output gives me
[Errno 2] No such file or directory
When I try to make the call like this:
subprocess.call(["soffice", "--headless", "--convert-to", "odt", pipes.quote(oldpath),outdir])
The result is the helptext of soffice, with the the reason:
LibreOffice 4.2.8.2 420m0(Build:2)
Unknown option: --outdir /targetpath/template.odt
...
Why not try with os.system ?
os.system('soffice --headless --convert-to odt "/path/template.ott" --outdir "/targetpath/template.odt"')