[reportlab-users] ReportLab & py2exe

Larry Bates reportlab-users@reportlab.com
Thu, 5 Jun 2003 10:09:47 -0500


Thanks for the reply.  Unfortunately I had already tried this solution
and it didn't solve the problem.  It must have something to do with the
scope of the plugins.  If I load them in my main program I can open
the file with Image.open, but when reportlab tries to do the same
down inside of drawinlineImage it can't locate the plugin (even though
I've loaded it in the main program).  I tried inserting the import in
every place that seemed to make sense and nothing worked.

FYI, Larry

-----Original Message-----
From: reportlab-users-admin@reportlab.com
[mailto:reportlab-users-admin@reportlab.com]On Behalf Of Robin Becker
Sent: Thursday, June 05, 2003 3:11 AM
To: reportlab-users@reportlab.com
Subject: Re: [reportlab-users] ReportLab & py2exe

In article <015101c32ae7$09edd7a0$9500a8c0@larrywxp>, Larry Bates
<lbates@syscononline.com> writes
>I was wondering if anyone had experience "freezing" a reportlab application
>Thomas Heller's py2exe utility.  I have used it to freeze many other
>but I'm having trouble with my latest one.  Basically I'm creating .PDF
>incoming pages from my fax gateway.  Since reportlab utilizes PIL, the app
>blows up on drawinlineimage because PIL PcxImagePlugin isn't available.
>I tried importing it manually and tested it by opening the file in my main
>program and it works properly.  It just blows up down deep in reportlab.
>Any suggestions?
>Thanks in advance for any assistance.
>Larry Bates

The F bot posted this recently
> Kevin Dahlhausen wrote:

> Anyone come across the problem of PIL not being able to identify image
> files once it's compiled with py2exe?

google knows... ;-)

> Do I need to manually add some plugins to the setup or something?

PIL scans sys.path for plugins (*ImagePlugin files).  When running under
py2exe (or any other wrapper), you have to import them yourself.  Just
add import statements to your main program for all the formats you need:

    import JpegImagePlugin
    import PngImagePlugin
    import BmpImagePlugin
    import GifImagePlugin
    # etc

(to get a complete list, look in the PIL package directory)

Robin Becker
reportlab-users mailing list