473,287 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Using PIL with py2exe

Does anyone know how to embed PIL into a py2exe program.

As far as I can tell PIL is not finding its plugins for Image I/O,
they are imported dynamically as required. So I cant load or save
pictures

I tried making a copy of the plugin files to the application
directory, but I've had no luck in making the code see the files
I'd be grateful for any suggestion.

Please e-mail me, as well as posting a reply.

John Carter
jn*@ecs.soton.ac.uk
Jul 18 '05 #1
2 3068
On Wed, 10 Dec 2003 16:04:41 +0000, John Carter <jn*@ecs.soton.ac.uk>
wrote:
Does anyone know how to embed PIL into a py2exe program.

As far as I can tell PIL is not finding its plugins for Image I/O,
they are imported dynamically as required. So I cant load or save
pictures

I tried making a copy of the plugin files to the application
directory, but I've had no luck in making the code see the files
I'd be grateful for any suggestion.

Please e-mail me, as well as posting a reply.

John Carter
jn*@ecs.soton.ac.uk


PIL imports the drivers dynamically, so py2exe doesn't find them.
Including these lines should solve your problem.

## Static imports from PIL for py2exe
from PIL import GifImagePlugin
from PIL import JpegImagePlugin
Jul 18 '05 #2
Hello David,
Does anyone know how to embed PIL into a py2exe program.

As far as I can tell PIL is not finding its plugins for Image I/O,
they are imported dynamically as required. So I cant load or save
pictures

PIL imports the drivers dynamically, so py2exe doesn't find them.
Including these lines should solve your problem.

## Static imports from PIL for py2exe
from PIL import GifImagePlugin
from PIL import JpegImagePlugin

I had the same problem, created a script call pil2exe which I import in my modules.

--- pil2exe.py ---
'''Fix allowing PIL to work under py2exe'''

__author__ = "Miki Tebeka <mi***@zoran.co.il>"
# $Id: pil2exe.py,v 1.2 2003/10/20 11:35:38 mikit Exp $

#FIXME:
# Hand pick only the modules you need (currently all *Plugin.py from PIL
# directory are imported)

#FIXME: Find who's the criminal and why, currently disable warnings
import warnings
warnings.filterwarnings("ignore")

import ArgImagePlugin
import BmpImagePlugin
import CurImagePlugin
import DcxImagePlugin
import EpsImagePlugin
import FliImagePlugin
import FpxImagePlugin
import GbrImagePlugin
import GifImagePlugin
import IcoImagePlugin
import ImImagePlugin
import ImtImagePlugin
import IptcImagePlugin
import JpegImagePlugin
import McIdasImagePlugin
import MicImagePlugin
import MpegImagePlugin
import MspImagePlugin
import PalmImagePlugin
import PcdImagePlugin
import PcxImagePlugin
import PdfImagePlugin
import PixarImagePlugin
import PngImagePlugin
import PpmImagePlugin
import PsdImagePlugin
import SgiImagePlugin
import SunImagePlugin
import TgaImagePlugin
import TiffImagePlugin
import WmfImagePlugin
import XVThumbImagePlugin
import XbmImagePlugin
import XpmImagePlugin
--- pil2exe.py ---

Use at your own risk :-)

HTH.
Miki
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: RJS | last post by:
Hi all, I can't get a py2exe compiled app to run with numarray (numarray-0.5.win32- py2.2). Also wxPythonWIN32-2.3.3.1-Py22 and ActivePython-2.2.1-222. In the sample below, commenting out...
6
by: Luc Saffre | last post by:
Hello, I had a strange problem when freezing (using either py2exe or McMillan installer) a script that imports reportlab (which imports PIL (which imports FixTk))). - Python 2.3.3c (also with...
11
by: Grant Edwards | last post by:
I'm trying in vain to set the icon for the executable generated by py2exe. According to various sources there are two answers: 1) Do it on the command line: python setup.py py2exe --icon...
4
true911m
by: true911m | last post by:
Here's a little walkthrough to get py2exe up and running. I'm not an expert, so I can't help much with any problems you might have. This is what worked for me. The result here will be to convert...
3
by: vajratkarviraj | last post by:
i hav python2.5, matplotlib0.90.1, and py2exe for python 2.5 all on windows xp... i hav a python program(letsc.py) which uses the matplotlib package... and i want 2 make an exe of it for distribution...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.