Re: Canvas does not work with SpooledTemporaryFile

Robert Schroll <[email protected]> Thu, 18 Mar 2021 22:25:11 -0700
Newsgroups gmane.comp.python.reportlab.user
Message-ID <CAPZyTkkXu7ADYjP8ueQX-CzPQ01cxJmjwfczkmANL6DF6Yve3Q@mail.gmail.com>
On Mon, Mar 15, 2021 at 2:11 AM Robin Becker <[email protected]> wrote:

> it gives us a bit of extra information should we ever see the filename.
> However, there's a flaw in that as soon as the
> file gets rolled over (if it ever does) then it will presumably get a name
> and it won't be the same.
>

That looks reasonable to me.  In my case, I was looking to use a
SpooledTemporaryFile to convey the output of ReportLab to pdfrw.  If the
file is small, it's better to keep it all in memory, but if it's large,
it'd be better to let it roll over to disk.   The SpooledTemporaryFile
should let that happen automatically.  I don't actually care where it's
stored, so the filename changing doesn't bother me at all.

Thanks for the quick fix,
Robert