[Pythonmac-SIG] PyObjC: debugging error-less crashes?

Daniel Ashbrook anjiro at cc.gatech.edu
Wed Jul 23 17:57:25 CEST 2008

I'm working my way through the excellent book "Cocoa Programming for Mac 
OS X", but using PyObjC instead of ObjC. For the most part it's working 
very well - a testament to the awesomeness of PyObjC!

However, I'm occasionally getting a crash from my application that gives 
no errors - it just enters into the debugger with no other output. A 
backtrace leads through C code to (inevitably) objc_msgSend(), which 
doesn't help much.

In one case I managed to figure out that I needed to add myFunc_ = 
objc.accessor(myFunc_) after the definition of myFunc_() (though I have 
no clue why), but in the current case that doesn't help. The relevant 
chunk of code is below. My debug log shows the "Ending alert sheet" 
message, but not the "Alert ended" message.

def removeEmployee_(self, sender):
     selectedPeople = self._employeeController.selectedObjects()
     alert = 
u'Delete', u'Cancel', None, u'Do you really want to delete %d people?' % 
     NSLog(u'Starting alert sheet')
self, 'alertEnded:code:context:', None)
     NSLog(u'Ending alert sheet')

def alertEnded_code_context_(self, alert, choice, context):
     NSLog(u'Alert ended')
     if choice == NSAlertDefaultReturn:

Thanks in advance for any hints, whether general or specific!

Daniel Ashbrook

More information about the Pythonmac-SIG mailing list