Skip to main content

I am creating a PDF report in a PythonCaller and currently I am writing it into a subfolder of FME_SHAREDRESOURCE_TEMP.

I would like to know where I have to write the file to be able to generate a download link for it.
When I use normal writers than I reference the writer in the Download Service… but with a PythonCaller?

Hi ​@tb09114 ,

A simple solution I can think of is, add a File Copy wirter to the workspace so that the file created by the Python script will be moved to a location, then publish the workspace to FME Flow as Data Download Service including the writer as a download writer.


I suspect that the simplest and most robust solution would be to write the PDF to a temporary folder in your PythonCaller (e.g. using the tempfile Python module or the TempPathnameCreator transformer), then read it back into the workspace with a FeatureReader using the DATAFILE binary format. Then send it to a regular writer, also of type DATAFILE, which you publish for the Download service. Be sure to set the mime-type accordingly, e.g. application/pdf.


@takashi What my PythonCaller returns is the path of the PDF report. The File Copy writer sounds like an easy solution but I have a hard time to set it up so it actually is using the path string to copy/move the file to another destination.


If the output feature from the PythonCaller has an attribute storing the file path of the PDF report, just rename it to “filecopy_source_dataset” then send the feature to the File Copy writer.


@takashi your tip about the filecopy_source_dataset has ended months of frustration!!!!  Thank you!

I’ve been facing the same problem with an Excel I generate with Python due to a lot of advanced formatting, I’ve tried so many things but no joy until your tip!!!