[reportlab-users] Thread safety of reportlab?

Andy Robinson andy at reportlab.com
Fri Dec 2 03:43:23 EST 2011


On 2 December 2011 07:25, Werner Thie <werner at thieprojects.ch> wrote:

> Hi all

>

> before setting sail into unknown territory I better ask if reportlab is

> Python thread safe.

>

> I have a desktop app with wxPython running, which allows pulling together

> great reports with the help of z3c-rml. Moving parts of the app to a web

> server implemented with twisted might be another story. The thing to do

> would be deferToThread() to let reportlab do its chore, given its thread

> safe, else I would have to spawn processes, which complicates the solution

> considerably.

>


People have been using it in long-running web architectures for years
with no complaints.
As far as we know, ReportLab is thread-safe if used sensibly. By this
I mean that you should construct a new story, doctemplate and content
for each job, and don't try to share objects between documents. In
our commercial product, RML, we construct the entire object graph for
every job.

You can, of course, do strange things like have a shared stylesheet,
one thread trying to set your heading-1 to pink and another to blue,
and get into trouble that way if you wish!
However, I have been in IT too long to claim that it is "guaranteed
thread safe".

Best Regards,

--
Andy Robinson
Managing Director
ReportLab Europe Ltd.
Thornton House, Thornton Road, Wimbledon, London SW19 4NG, UK
Tel +44-20-8405-6420


More information about the reportlab-users mailing list