Skip to content

Commit

Permalink
Pass absolute file paths to inkscape
Browse files Browse the repository at this point in the history
Since the command is run in `task.workdir` instead of the original working
directory, the potentially relative paths passed by the caller(s) may not
point to actual files when running inkscape, which results in failed
renderings.

This seems to have mainly affected running under `--debug`, but should fix
voc#40 (which doesn't say the issue was seen under `--debug` though).
  • Loading branch information
mstock committed Jul 15, 2021
1 parent 1f57235 commit 8e9d74b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion renderlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def renderFrame(infile, task, outfile):
converted.save(filename=outfile)
else:
# invoke inkscape to convert the generated svg-file into a png inside the .frames-directory
cmd = 'inkscape --export-background=white --export-background-opacity=0 --export-width={1} --export-height={2} --export-png="{3}" "{4}" 2>&1 >/dev/null'.format(task.workdir, width, height, outfile, infile)
cmd = 'inkscape --export-background=white --export-background-opacity=0 --export-width={1} --export-height={2} --export-png="{3}" "{4}" 2>&1 >/dev/null'.format(task.workdir, width, height, os.path.abspath(outfile), os.path.abspath(infile))
errorReturn = subprocess.check_output(cmd, shell=True, universal_newlines=True, stderr=subprocess.STDOUT, cwd=task.workdir)
if errorReturn != '':
print("inkscape exitted with error\n" + errorReturn)
Expand Down

0 comments on commit 8e9d74b

Please sign in to comment.