[Image-SIG] ImageTk.PhotoImage: DLL load failed: The specified module could not be found.

Fredrik Lundh fredrik at pythonware.com
Thu Jul 9 13:26:24 CEST 2009

On Wed, Jul 8, 2009 at 12:24 PM, Jean-Paul Miéville<jpmieville at gmail.com>

> I have an problem with ImageTk.PhotoImage.
> When I try to use it with for example with the following script:
> import ImageTk
> import Image
> import tkFileDialog
> imgFile = tkFileDialog.askopenfilename()
> if imgFile:
>     image = Image.open(imgFile)
>     chart = ImageTk.PhotoImage(image)
> I got the following error:
> Traceback (most recent call last):
>   File "C:\Python\PythonScript\Test\Script1.py", line 9, in <module>
>     chart = ImageTk.PhotoImage(image)
>   File "C:\Python25\Lib\site-packages\PIL\ImageTk.py", line 116, in __init__
>     self.paste(image)
>   File "C:\Python25\Lib\site-packages\PIL\ImageTk.py", line 181, in paste
>     import _imagingtk
> ImportError: DLL load failed: The specified module could not be found.
> The file _imagingtk is present in the path C:\Python25\Lib\site-packages\PIL\.
> I don't understand what is wrong. I am using ActivePython
> (ActiveState Software Inc.)base on Python 2.5.4 (r254:67916, Apr 27
> 2009, 15:41:14).

Most likely, it cannot find the Tcl/Tk DLL:s.

You should get a slightly more informative error message if you run
Python in a console window and type:

    import _imagingtk

What Tcl/Tk version is ActiveState's distribution using, btw?
To find out, do:

>>> import Tkinter
>>> print Tkinter.TclVersion

If this says something other than 8.4, your AS release isn't
compatible with the python.org builds.


More information about the Image-SIG mailing list