system.report.executeAndDistribute: printing report, path not found

Hello there,
I’m new at Ignition, so what I’m trying to do is maybe a wrong approach but I can’t find another way.

I have a sequence where at some point I save a report with the save option of the system.report.executeAndDistribute function:

 Path =	"D:\\Program files2\\Ignition_install\\REPORTS\\"
 settings = {"path":Path, "fileName":Name, "format":"pdf"}
 system.report.executeAndDistribute(path="LNG_COMP_REP_2", project=project, action="save",   actionSettings=settings)

This is ok, the file is saved on the right place.
I also copy the report name to a memory tag and via a gateway tag change script I would like to print that latest report:

Lastreport = system.tag.readBlocking(['[SAMPLER_TAGS]SAMPLER/PROJECT/SAMPLING_STATUS/S1_Last_Report_Name'])[0].value
Reportpath = "D:\\Program files2\\Ignition_install\\REPORTS\\"+Lastreport

project = 'SAMPLER'
printer = 'IgnitionPrinter'
settings = {"primaryPrinterName":printer, "copies":1}

system.report.executeAndDistribute(path=Reportpath, project=project, action='print', actionSettings=settings)

But what ever I try I keep on getting the message “Report path D:\Program files2\Ignition_install\REPORTS\SAMPRPRT.pdf can not be found”

In the wrapper log the path name is good, if I put it in windows exporer the right file is opened.
I also have a file exporer and pdf viewer both show the correct report.
But with the tag change script it does not work.

Should I specify the path in another way or do something else?

I’m running Ignition designer 8.1.17 with Vision in trial mode, both gateway and designer are on the same PC.

I really would appreciate some help, thanks in advance.

Welcome to the forum. Tip: use the </> code formatting button when posting code. It will indent properly (important for Python) and give syntax highlighting. You can use the 🖉 edit link to fix your post.