|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
|
|
|
PIL and Snow Leopard
When I run the Apple Python in 32 bit mode I get a bus error at the same place when I try to display an image using PIL . Here is part of the dump. Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000028 Crashed Thread: 0 Dispatch queue: com.apple.main-thread Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 com.tcltk.tklibrary 0x13a1850b Tk_GetImageMasterData + 17 1 com.tcltk.tklibrary 0x13a20cab Tk_FindPhoto + 37 2 _imagingtk.so 0x007faacf PyImagingPhotoPut + 95 3 com.tcltk.tcllibrary 0x138d3d64 TclInvokeStringCommand + 101 4 com.tcltk.tcllibrary 0x00489977 Tcl_CreateInterp + 4919 5 com.tcltk.tcllibrary 0x0048a96c Tcl_EvalObjv + 72 6 _tkinter.so 0x001e449d Tkapp_CallDeallocArgs + 11750 7 org.python.python 0x0008b372 PyEval_EvalFrameEx + 16375 8 org.python.python 0x0008cf64 PyEval_EvalCodeEx + 1720 9 org.python.python 0x0008b591 PyEval_EvalFrameEx + 16918 10 org.python.python 0x0008cf64 PyEval_EvalCodeEx + 1720 11 org.python.python 0x0002ee2c PyClassMethod_New + 1823 12 org.python.python 0x0000c700 PyObject_Call + 101 13 org.python.python 0x0001c12e PyClass_New + 1603 14 org.python.python 0x0000c700 PyObject_Call + 101 15 org.python.python 0x0008677a PyEval_CallObjectWithKeywords + 171 16 org.python.python 0x0001ba58 PyInstance_New + 290 17 org.python.python 0x0000c700 PyObject_Call + 101 18 org.python.python 0x0008c802 PyEval_EvalFrameEx + 21639 19 org.python.python 0x0008cf64 PyEval_EvalCodeEx + 1720 20 org.python.python 0x0002ee2c PyClassMethod_New + 1823 21 org.python.python 0x0000c700 PyObject_Call + 101 22 org.python.python 0x0001c12e PyClass_New + 1603 23 org.python.python 0x0000c700 PyObject_Call + 101 24 org.python.python 0x0008677a PyEval_CallObjectWithKeywords + 171 25 org.python.python 0x0001ba58 PyInstance_New + 290 26 org.python.python 0x0000c700 PyObject_Call + 101 27 org.python.python 0x0008c802 PyEval_EvalFrameEx + 21639 28 org.python.python 0x0008cf64 PyEval_EvalCodeEx + 1720 29 org.python.python 0x0008d009 PyEval_EvalCode + 87 30 org.python.python 0x000a40bb Py_CompileString + 111 31 org.python.python 0x000a4167 PyRun_FileExFlags + 139 32 org.python.python 0x000a5e8a PyRun_SimpleFileExFlags + 814 33 org.python.python 0x000b3168 Py_Main + 3074 34 org.python.python.app 0x00001eb5 start + 53 The crash occurs at the same 'place' every time... If I run the Apple Python in 64 bit mode or the python.org Python ( 32 bit carbon 2.6.2 )image displaying, ie PIL, works fine :) Sorta strange... Here is a sample program that can be used... #!/usr/bin/env python # Author: Jerry LeVan from Tkinter import * import Image, ImageTk import StringIO from tkMessageBox import * class ShowImage: def build_scrolled_canvas(self,parent): canvas=Canvas(parent) sy = Scrollbar(parent, command=canvas.yview) sx = Scrollbar(parent, orient=HORIZONTAL, command= canvas.xview) canvas.configure(yscrollcommand=sy.set,xscrollcommand=sx.set) canvas.grid(row=0,column=0,sticky=NSEW) sy.grid(row=0,column=1,stick=N+S) sx.grid(row=1,column=0,sticky=E+W) parent.columnconfigure(0,weight=1) parent.rowconfigure(0,weight=1) return canvas def __init__(self, theStr): self.theStr = theStr self.theWin = Toplevel() self.theWin.title('Image Viewer') self.theFrame = Frame(self.theWin) self.theCanvas = self.build_scrolled_canvas(self.theFrame) self.theButton= Button(self.theWin,text="Close",command=self.theWin.destroy) self.theFrame.pack(side=TOP, expand=TRUE, fill=BOTH) self.theButton.pack(side=TOP) try: self.im = Image.open(StringIO.StringIO(self.theStr)) (width,height) = self.im.size self.tkim = ImageTk.PhotoImage(self.im) self.theCanvas.create_image(0,0,image=self.tkim,anchor=NW) self.theCanvas['scrollregion'] = (0,0,width,height) except Exception, e : showerror(title="Error",message="image problem: "+str(e)) self.theWin.destroy() if __name__ == '__main__': theStr = open(sys.argv[1],'rb').read() thePic = ShowImage(theStr) myPic = ShowImage(theStr) mainloop() _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@... http://mail.python.org/mailman/listinfo/pythonmac-sig |
|
|
PIL and Snow Leopard
Bah, Humbug... I used otool to peek at _imagetk.so and found that the linker had picked up the ActiveState Tcl/tk Frameworks in /Library/Frameworks... So I hid the active state frameworks for tcl and tk and just to be safe I hid the community python from python.org. I made sure that the Apple Python was in my path and rebuilt PIL. This time it appears that all is well. The Apple frameworks for Tcl and Tk were picked up :) I have been able to use PIL to display images via Apple's Python running in 64 or 32 bit mode. I have a better handle on my WxPython problem...I think I was releasing a table for a grid a bit too soon... Things are starting to look up :) Jerry _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@... http://mail.python.org/mailman/listinfo/pythonmac-sig |
| Free embeddable forum powered by Nabble | Forum Help |