[Image-SIG] Help: Converting PIL to Tkinter image objects crashes python

Tom Baldwin tbaldwin at uoregon.edu
Thu Jul 9 23:50:58 CEST 2009

Hey everyone,

I'm having some trouble displaying PIL image objects in a Tkinter window,
and I'm looking for help. The function PIL.ImageTk.PhotoImage fails and
crashes python, displaying the following (unhelpful) error message in the

alloc: invalid block: 0x708338: b0 0 0
Abort trap

I have attached a quick program which should demonstrate the problem
(replace 'ex.jpg' with any image which you have).

I have searched the internet for help and haven't found a solution.
Moreover, I tried running some sample scripts found in tutorials online, and
they fail in the same manner. This leads me to believe that there's a bug in
PIL, or a problem with my installation, which leads to this incompatibility.

I am running python 2.6.2 on Mac OS 10.5. I installed everything from source
using Macports. My Tcl/Tk version is 8.5.6, and my PIL version is 1.1.6. For
what it's worth, this also happens on my Python 2.5 installation.

A python-help volunteer suggested downgrading my Tcl/Tk installation from
8.5 to 8.4, which seems a little weird, since 8.5 has been stable since
December 2007. (Also, downgrading things using Macports is so complicated
that I haven't succeeding in doing it yet.) He directed me to this list for
more knowledgeable help.

Can anyone with PIL familiarity tell me what might be causing this error? Or
say if there is any reason to believe that Tcl 8.4 might be more compatible?

Thank you for any help you can give.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20090709/f0410a90/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reproducer.py
Type: application/octet-stream
Size: 516 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20090709/f0410a90/attachment.obj>

More information about the Image-SIG mailing list