Skip to content

subprocess.Popen call can't find pdftk on Windows #11

@dgwaldo

Description

@dgwaldo

We have been running pdfjinja and have ran into an interesting issue. When calling our python code directly from the command line everything works. However when our code is started by another calling process, in this case ArcGIS Server, it fails on the call to Popen.

If we hard code our path to pdftk into pdfjinja like so, it works.

args = [
r"C:\Windows\SysWOW64\PDFtk Server\bin\pdftk.exe",
self.filename,
"fill_form", "-",
"output", "-",
"dont_ask",
"flatten"
]

I believe it has something to do with the following Python bug, and isn't directly an issue with pdfjinja.
https://bugs.python.org/issue8557

Root cause seems to be that Popen isn't respecting anything on the System PATH variable in Windows.

However, perhaps there is a way around it in pdfjinja? Like perhaps passing down the current env into the process being opened. The issue is a bit of a maintainability nightmare for us.

Additionally, I've found a very similar issue that may be helpful.
https://gis.stackexchange.com/questions/234664/how-to-set-up-geoprocessing-service-to-fill-out-pdf-form-from-within-web-appbuil

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions