R: R: Py2exe beginner troubles

Fabrizio facelle at jumpy.it
Fri Sep 28 13:33:56 EDT 2001


Thanks for your reply, but I still cannot get it to work.

This is my program (it's a basic one which I got from the tutorial. It gets
all .jpg files in a directory, create thumbnails for them and copy them into
another place with a different file extension) which uses PIL :

############################

import os, sys, glob
import Image

# I have added the following two lines just trying to get py2exe compatibily
:
import BmpImagePlugin, JpegImagePlugin, PngImagePlugin
import SgiImagePlugin, SunImagePlugin, TgaImagePlugin, TiffImagePlugin

dir = os.getcwd ()
for infile in  glob.glob("*.jpg"):
    file = os.path.join(dir,infile)
    outfile = os.path.splitext(file)[0] + ".thj"
    if infile != outfile:
        try:
            im = Image.open(infile)
            im.thumbnail((180, 135))
            im.save(outfile, "JPEG", quality=95)
            # im.show()
        except IOError:
            print "Could not create thumbnail for image ", infile

#############################


And this is the error I get from py2exe :

--------------------------------

Resolving binary dependencies:
error: tcl83.dll: No such file or directory

-------------------------------

Any help is welcome.

Thanks in advance.


Fabrizio


> >
> > By the way, is PIL (Python Imaging Library) supported by py2exe ?


> It is but you have to import the modules that you need that are loaded
> dynamically, ie instead of
>
> import Image
>
> do something like
>
> import Image
> import BmpImagePlugin, JpegImagePlugin, PngImagePlugin, SgiImagePlugin,
SunImagePlugin, TgaImagePlugin, TiffImagePlugin
>
> Thats, at a guess, the reason for the error. You could probably cause the
import
> on a py2exe command line flag, but I haven't tried it.
>
> Cheers
>
> --
> Lee Morgan







More information about the Python-list mailing list