AnvilWrappedError: Invalid print session

Continuing the discussion from [BUG] Revive of a bug! PDF generation via Scheduled Task:

What I’m trying to do:
Create a PDF via scheduled Task.

What I’ve tried and what’s not working:
Verified that the code runs without error when called from via anvil.server.call()

I have also tried scheduling the task as per the post above.
This throws AnvilWrappedError: Invalid print session from the anvil.pdf.PDFRenderer()

Is there a requirement for a valid Client Side session to be running to access the PDFRenderer?

Unfortunately, I can’t tell you what fixed it, but it does work in my scheduled task currently. In the original post I referenced, it was a bug fixed by anvil.

However, I know you can’t call the PDFRenderer() from a server console. Is this background task in a uplink server? I don’t know if that matters, but it could be a reason … maybe.

1 Like

I have tried both Scehduled Tasks and Server console.
Also tried anvil.pdf.PDFRenderer() as well as anvil.pdf.render_form()
Unfortunately they throw the same exception