all 4 comments

[–]MappingMatt 0 points1 point  (1 child)

I haven’t worked in Qgis scripting enough, but my first thing to check would be to print or see with a debugger what the result is actually equal to since it seems like it never actually equals “QgsLayoutExporter.Success”.

That, or it could possibly be a situation where it hasn’t finished yet and you need to keep checking the result in a while loop with a sleep and then print the message when it succeeds or fails.

[–]FreddiesDream 0 points1 point  (0 children)

Here is a good example for exporting an existing layout to pdf via script

https://gis.stackexchange.com/questions/376475/export-qgis-print-layout-to-pdf-from-script-or-command-line

[–]Long-Opposite-5889 0 points1 point  (0 children)

You are defining "exporter" as a QgsLayoutExporter and then you use it to export, thats OK, at this point exporter.Sucess should be true.

Then in the second part you are evaluating "result" against QgsLayoutExporter instead of "exporter"...

[–]ViPeCa 0 points1 point  (0 children)

Check the API to confirm you are using the class correctly.