<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><font class="Apple-style-span" color="#000000"><br></font>On Oct 2, 2009, at 7:40 PM, Bill Janssen wrote:<br><br><blockquote type="cite">Jerry LeVan &lt;<a href="mailto:jerry.levan@eku.edu">jerry.levan@eku.edu</a>&gt; wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Is building PIL on Snow Leopard 'easy' I have the apple python &nbsp;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">(32/64)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">installed and the <a href="http://python.org/">python.org</a> 2.6.2 (32 bit) version installed.<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Yes, I just build it with /usr/bin/python, and it works fine. &nbsp;&nbsp;<br></blockquote><blockquote type="cite">Assuming<br></blockquote><blockquote type="cite">you have Xcode 3.2 installed.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Bill<br></blockquote><br>Ugh, this is getting messy...<br><br>I think that I have built libfreetype.dylib and libjpeg.dylib as<br>i386 and x86_64 libs...at least that is what the file command asserts.<br><br>I then built the PIL package using the system python in 64 bit mode and<br>installed the rascal in the Apple python. All of the libs appear to be<br>multi-architecture ppc, i386 and x86_64<br><br>When I run apple python in 64 bit mode I can run the PIL demos...<br><br>If I restrict apple python to 32 bit mode all of the programs fail<br>with a bus error.<br><br>*********<br><br>I then tried to build PIL using the 2.6.2 python from <a href="http://python.org/">python.org</a>.<br>1) It would not build under gcc-4.2 I had to define CC=gcc-4.0<br> &nbsp;&nbsp;&nbsp;&nbsp;the build appeared to succeed and I installed the PIL system.<br>2) All of the demos failed...<br><br>I noticed that _imagingtk.so was dynamically linked against<br>the ActiveState Tcl/Tk that is installed in /Library/Frameworks/ <br>Tcl.framework<br><br>[mbp:/Library/Python/2.6/site-packages/PIL]$ otool -L _imagingtk.so<br>_imagingtk.so:<br><span class="Apple-tab-span" style="white-space:pre">        </span>/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (compatibility &nbsp;<br>version 8.5.0, current version 8.5.4)<br><span class="Apple-tab-span" style="white-space:pre">        </span>/Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility &nbsp;<br>version 8.5.0, current version 8.5.4)<br><span class="Apple-tab-span" style="white-space:pre">        </span>/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current &nbsp;<br>version 124.1.1)<br><br>I suppose that I could hide the ActiveState versions by renaming the &nbsp;<br>Frameworks...<br><br>But even if I did that, how could I force setup.py to use the apple &nbsp;<br>8.4 tcl/tk system instead<br>of the 'current' 8.5 system?<br><br>Any suggestions as to how I can get PIL to work when apple python is &nbsp;<br>in 32 bit mode?<br><br>Any suggestions as to how I can build PIL using the 2.6.2 version of &nbsp;<br>Python from <a href="http://python.org/">python.org</a>?<br><br>This is getting ugly...too many impedance mismatches.<br><br>Jerry<br><font class="Apple-style-span"><font class="Apple-style-span" color="#144FAE"><br></font></font></blockquote><br></div><div>A little more success to report. ..</div><div><br></div><div>I hid the activestate tcl/tk frameworks in /Library/Frameworks and set CC to gcc-4.0</div><div>and rebuilt PIL and otool showed that _imagingtk.so was linked against the apple 8.4</div><div>Tcl/Tk system.</div><div><br></div><div>So I installed the build and "tada" Imaging appears to be working in <a href="http://python.org/">python.org</a> version</div><div>of python (2.6.2).</div><div><br></div><div>So this leaves only the "why does apple python (2.6.1) not work when run in 32 bit mode</div><div>but does in 64 bit mode" &nbsp;question open...</div><div><br></div><div>Has anyone had success with PIL in this case?</div><div><br></div><div>Thanks&nbsp;</div><div><br></div><div>Jerry</div></div></blockquote></div><br><div>When I run the Apple Python in 32 &nbsp;bit mode I get a bus error at the same place when I try</div><div>to display an image using PIL . &nbsp;Here is part of the dump.</div><div><br></div><div><div>Exception Type: &nbsp;EXC_BAD_ACCESS (SIGBUS)</div><div>Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000028</div><div>Crashed Thread: &nbsp;0 &nbsp;Dispatch queue: com.apple.main-thread</div><div><br></div><div>Thread 0 Crashed: &nbsp;Dispatch queue: com.apple.main-thread</div><div>0 &nbsp; com.tcltk.tklibrary &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x13a1850b Tk_GetImageMasterData + 17</div><div>1 &nbsp; com.tcltk.tklibrary &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x13a20cab Tk_FindPhoto + 37</div><div>2 &nbsp; _imagingtk.so &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x007faacf PyImagingPhotoPut + 95</div><div>3 &nbsp; com.tcltk.tcllibrary &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span>0x138d3d64 TclInvokeStringCommand + 101</div><div>4 &nbsp; com.tcltk.tcllibrary &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span>0x00489977 Tcl_CreateInterp + 4919</div><div>5 &nbsp; com.tcltk.tcllibrary &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span>0x0048a96c Tcl_EvalObjv + 72</div><div>6 &nbsp; _tkinter.so &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x001e449d Tkapp_CallDeallocArgs + 11750</div><div>7 &nbsp; org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0008b372 PyEval_EvalFrameEx + 16375</div><div>8 &nbsp; org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0008cf64 PyEval_EvalCodeEx + 1720</div><div>9 &nbsp; org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0008b591 PyEval_EvalFrameEx + 16918</div><div>10 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0008cf64 PyEval_EvalCodeEx + 1720</div><div>11 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0002ee2c PyClassMethod_New + 1823</div><div>12 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0000c700 PyObject_Call + 101</div><div>13 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0001c12e PyClass_New + 1603</div><div>14 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0000c700 PyObject_Call + 101</div><div>15 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0008677a PyEval_CallObjectWithKeywords + 171</div><div>16 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0001ba58 PyInstance_New + 290</div><div>17 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0000c700 PyObject_Call + 101</div><div>18 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0008c802 PyEval_EvalFrameEx + 21639</div><div>19 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0008cf64 PyEval_EvalCodeEx + 1720</div><div>20 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0002ee2c PyClassMethod_New + 1823</div><div>21 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0000c700 PyObject_Call + 101</div><div>22 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0001c12e PyClass_New + 1603</div><div>23 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0000c700 PyObject_Call + 101</div><div>24 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0008677a PyEval_CallObjectWithKeywords + 171</div><div>25 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0001ba58 PyInstance_New + 290</div><div>26 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0000c700 PyObject_Call + 101</div><div>27 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0008c802 PyEval_EvalFrameEx + 21639</div><div>28 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0008cf64 PyEval_EvalCodeEx + 1720</div><div>29 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x0008d009 PyEval_EvalCode + 87</div><div>30 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x000a40bb Py_CompileString + 111</div><div>31 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x000a4167 PyRun_FileExFlags + 139</div><div>32 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x000a5e8a PyRun_SimpleFileExFlags + 814</div><div>33 &nbsp;org.python.python &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x000b3168 Py_Main + 3074</div><div>34 &nbsp;org.python.python.app &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>0x00001eb5 start + 53</div><div><br></div><div>The crash occurs at the same 'place' every time...</div><div><br></div><div>If I run the Apple Python in 64 bit mode or the <a href="http://python.org">python.org</a> Python ( 32 bit carbon 2.6.2 )image displaying, ie PIL, &nbsp;works fine :)</div><div><br></div><div>Sorta strange...</div><div><br></div><div>Here is a sample program that can be used...</div><div><br></div><div><div>#!/usr/bin/env python &nbsp;</div><div># Author: Jerry LeVan</div><div>from Tkinter import *</div><div>import Image, ImageTk</div><div>import StringIO</div><div>from tkMessageBox import *</div><div><br></div><div>class ShowImage:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp;</div><div>&nbsp;&nbsp;def build_scrolled_canvas(self,parent):</div><div><br></div><div>&nbsp;&nbsp; &nbsp; canvas=Canvas(parent) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp;&nbsp; &nbsp; sy = Scrollbar(parent, command=canvas.yview)</div><div>&nbsp;&nbsp; &nbsp; sx = Scrollbar(parent, orient=HORIZONTAL,</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;command= canvas.xview)</div><div>&nbsp;&nbsp; &nbsp; canvas.configure(yscrollcommand=sy.set,xscrollcommand=sx.set) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp;&nbsp; &nbsp; canvas.grid(row=0,column=0,sticky=NSEW)</div><div>&nbsp;&nbsp; &nbsp; sy.grid(row=0,column=1,stick=N+S)</div><div>&nbsp;&nbsp; &nbsp; sx.grid(row=1,column=0,sticky=E+W)</div><div>&nbsp;&nbsp; &nbsp; parent.columnconfigure(0,weight=1)</div><div>&nbsp;&nbsp; &nbsp; parent.rowconfigure(0,weight=1)</div><div>&nbsp;&nbsp; &nbsp; return canvas</div><div><br></div><div>&nbsp;&nbsp;def __init__(self, theStr):</div><div>&nbsp;&nbsp; &nbsp;self.theStr = theStr&nbsp;</div><div>&nbsp;&nbsp; &nbsp;self.theWin = Toplevel()</div><div>&nbsp;&nbsp; &nbsp;self.theWin.title('Image Viewer')</div><div>&nbsp;&nbsp; &nbsp;self.theFrame = Frame(self.theWin)</div><div>&nbsp;&nbsp; &nbsp;self.theCanvas = self.build_scrolled_canvas(self.theFrame)</div><div>&nbsp;&nbsp; &nbsp;self.theButton= Button(self.theWin,text="Close",command=self.theWin.destroy)</div><div>&nbsp;&nbsp; &nbsp;self.theFrame.pack(side=TOP, expand=TRUE, fill=BOTH)</div><div>&nbsp;&nbsp; &nbsp;self.theButton.pack(side=TOP)</div><div>&nbsp;&nbsp; &nbsp;try:</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; self.im = Image.open(StringIO.StringIO(self.theStr))</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; (width,height) = self.im.size</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; self.tkim = ImageTk.PhotoImage(self.im)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; self.theCanvas.create_image(0,0,image=self.tkim,anchor=NW)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; self.theCanvas['scrollregion'] = (0,0,width,height)</div><div>&nbsp;&nbsp; &nbsp;except Exception, e :</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; showerror(title="Error",message="image problem: "+str(e))</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; self.theWin.destroy()</div><div><br></div><div>if __name__ == '__main__':</div><div>&nbsp;&nbsp; &nbsp;theStr = open(sys.argv[1],'rb').read()</div><div>&nbsp;&nbsp; &nbsp;thePic = ShowImage(theStr)</div><div>&nbsp;&nbsp; &nbsp;myPic = ShowImage(theStr)</div><div>&nbsp;&nbsp; &nbsp;mainloop()</div><div><br></div></div></div></body></html>