[reportlab-users] Report lab/PIL and py2exe

Larry Bates reportlab-users@reportlab.com
Mon, 8 Mar 2004 08:40:51 -0600

It definitely has to do with the fact that PIL does 
some "funny" dynamic loading of the plug-ins for each
different graphic format.  I supposed that ultimately
it might be considered a "PIL" problem but if I am
using PIL in my main program, I can just import the
appropriate plug-ins manually at the top of my 
program and it "fixes" the problem for py2exe.  Inside
of ReportLab this doesn't work.  I must go all the
way down into the module that is importing PIL and
insert the imports manually into that module (which
is sort of a "ReportLab" problem).  Changing code
down deep in ReportLab always makes me uncomfortable
because it makes doing version updates much more

I would suggest that being able to reliably "freeze"
a program that includes ReportLab/PIL with py2exe is 
a very good thing (it is very important for distribution).

The simple solution is to just import all the plug-ins.
I may not be terribly efficient, but it does fix the
problem easily.


-----Original Message-----
From: reportlab-users-admin@reportlab.com
[mailto:reportlab-users-admin@reportlab.com]On Behalf Of
Sent: Saturday, March 06, 2004 1:59 AM
To: reportlab-users@reportlab.com
Subject: reportlab-users digest, Vol 2 #49 - 1 msg

Send reportlab-users mailing list submissions to

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

When replying, please edit your Subject line so it is more specific
than "Re: Contents of reportlab-users digest..."

Today's Topics:

   1. RE: Reportlab/PIL and py2exe (Andy Robinson)


Message: 1
From: "Andy Robinson" <andy@reportlab.com>
To: <reportlab-users@reportlab.com>
Subject: RE: [reportlab-users] Reportlab/PIL and py2exe
Date: Fri, 5 Mar 2004 01:34:53 -0000
Reply-To: reportlab-users@reportlab.com

> I've been struggling to get Reportlab to work with py2exe.
> Specifically the problem is that after a .PY file is 
> "frozen" into .EXE any calls to Canvas.drawInlineImage
> fail because ImageReader doesn't have the necessary
> plugins to allow PIL.Image to determine the type of
> image that is being placed on the Canvas.

I don't know enough about this.  Is the problem with
PIL's "lazy loading" and needing to help py2exe
detect which PIL plugins should be included in the distro?
If so I'd argue it's a PIL problem.  If not, can you
explain why this works in the file system and not in
an EXE?

> Is my problem a common one or is it too obscure to 
> matter (I've encountered it a number of times in
> other applications that I've attempted to run through
> py2exe)?  Is there a better way to accomplish what
> I have "hacked"?
It's obscure, but we are very concerned with packing
whole apps in compact distributions, so it's certainly
worth getting to the bottom of it...

- Andy


reportlab-users mailing list

End of reportlab-users Digest