Re: [Pyobjc-dev] VTK bindings
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2003-12-02 13:48:37
|
On Dec 2, 2003, at 4:12 AM, Carlos Phillips wrote: > I'm trying to create a python-cocoa program with a VTK view. The VTK > view is taken verbatim from the two articles on MacDevCenter (link > follows) which is written in objective-c. > > http://www.macdevcenter.com/pub/a/mac/2003/02/11/dev_osx.html > http://www.macdevcenter.com/pub/a/mac/2003/03/25/dev_osx.html > > I am using an up-to-date CVS version of PyObjC. I have created a > project using the Cocoa-Python-ObjC template. I have placed the two > objective-c classes involved in the VTK view into the support > framework. I also have put renamed copies of the VTK cocoa objective-c > classes in this framework. This allows me to wrap the VTK view class > using objc.loadBundle. > > I have subclassed VTKView in python to emulate the program written in > the second macdevcenter article and instantiated it through the > MainMenu.nib. > > When I run the program, it crashes. It's log output is: > ===== > 2003-12-02 03:30:46.165 Simple1[1541] PyObjCPointer created: at > 0x6d16080 of type > {vtkRenderer={?={?={?=^^?i}C{vtkTimeStamp=^^? > L}^{vtkSubjectHelper}}^{vtkAssemblyPath}^{vtkPropCollection}iIff^{vtkPr > opCollection}^{vtkActor2DCollection}^{vtkWindow}[3f][4f][2f][2f][2f][2i > ][2i][3f][3f][4f]}^{vtkCamera}^{vtkLight}^{vtkLightCollection}^{vtkCull > erCollection}^{vtkActorCollection}^{vtkVolumeCollection}[3f]^{vtkRender > Window}ffiii*{vtkTimeStamp=^^? > L}fii^^{vtkProp}i^^{vtkAssemblyPath}iii[6f]f}8@0:4 > > Simple1 has exited due to signal 10 (SIGBUS). > ===== > > The Debugger complains that here is a lack of stack frames: > ===== > warning: Trying to remove a section from the ordered section list that > did not exist at 0x0. > Program received signal: "SIGTRAP". > warning: ppc_frame_chain_valid: stack pointer from 0xbffff84c to > 0x1000 grows upward; assuming invalid > > mi_cmd_stack_list_frames: Not enough frames in stack. > mi_cmd_stack_list_frames: Not enough frames in stack. > ===== > > Does anyone know what is going on? I know that quite a few people > would be happy if they could integrate VTK views into cocoa programs > using python and interface builder. When a PyObjCPointer is created, that means that some type came across the bridge that PyObjC has no idea how to handle, which causes a crash almost all the time. I have no idea about the stack frame business, but as soon as you see PyObjCPointer you might as well have crashed. If you post the exact source code you are using then I'll help you further (I don't know what selector is causing that message in your example), but you should read http://pyobjc.sourceforge.net/doc/wrapping.php If it can't be done properly by signature alone for whatever reason, then you have to write ObjC code to wrap that selector. -bob |