[reportlab-users] ReportLab & py2exe

Robin Becker reportlab-users@reportlab.com
Thu, 5 Jun 2003 09:11:26 +0100

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 from
>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