In article 
<CALcZXRHT=M2=bfdvu_if1tn2m4ktfw1u6hyjorchtwk5c8s...@mail.gmail.com>,
 Marc Culler <marc.cul...@gmail.com> wrote:

> This was reported here in February, but no debugging information was
> provided by the reporter:
> http://stackoverflow.com/questions/9142786/python-imagetk-photoimage-segfault
> <view-source:http://stackoverflow.com/questions/9142786/python-imagetk-photoim
> age-segfault>
> 
> I can explain the nature of the problem, but I don't know how to fix
> it correctly.
> 
> I am using the standard x86_64 Python 2.7.2 package from python.org and I 
> have
> installed Active State Tcl/Tk 8.11.
> 
> When I tried using easy_install to install PIL it would not load,
> claiming that _imaging.so
> did not exist.  In fact, it existed but was only a thin i386
> executable. So I compiled
> Imaging-1.1.7 with
>  export CFLAGS='-arch i386 -arch x86_64'
> and
>  export TCL_ROOT=/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
> 
> I was then able to load the module.  However, the following code
> produced a segfault:
> 
> import Image
> import ImageTk
> import Tkinter
> W = Tkinter.Tk()
> Im = Image.open('test_image.jpg')
> x = ImageTk.PhotoImage(Im)
> 
> The crash occurs in Tk_GetImageMasterData.  More importantly, though,
> the crash was
> preceded by the following messages:
> 
> objc[36554]: Class TKApplication is implemented in both
> /Library/Frameworks/Tk.framework/Versions/8.5/Tk and
> /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the
> two will be used. Which one is undefined.
> objc[36554]: Class TKMenu is implemented in both
> /Library/Frameworks/Tk.framework/Versions/8.5/Tk and
> /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the
> two will be used. Which one is undefined.

This sounds like a know bug with XCode 3.2.6 described here:
<https://discussions.apple.com/message/13314424?messageID=13314424#133144
24?messageID=13314424>

The problem is an incorrect link to /Library/Frameworks. The following 
fix suggested by "Nertzius" worked for me:

cd /Developer/SDKs/MacOSX10.6.sdk/Library;
sudo mv Frameworks Frameworks-orig
sudo mv Frameworks-orig/Frameworks .
sudo rm -rf Frameworks-orig

By the way, you can get an unofficial Mac binary installer for PIL, 
built for python.org python here:
<http://www.astro.washington.edu/users/rowen/python/>

-- Russell

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to