473,320 Members | 1,719 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,320 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 3070
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...
1
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: 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)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.