Re: [Pyobjc-dev] Possible bug in PyObjC bridge (SyncService)
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2010-04-30 05:40:31
|
On 29 Apr, 2010, at 17:57, Mani Ghasemlou wrote: > On Thu, Apr 29, 2010 at 11:45 AM, Aahz <aa...@py...> wrote: >> On Thu, Apr 29, 2010, Mani Ghasemlou wrote: >>> >>> Users of my app have been complaining of the following error: >>> >>> ValueError: NSInvalidArgumentException - *** -encodeInt:forKey: only >>> defined for abstract class. Define -[NSArchiver encodeInt:forKey:]! >>> >>> It occurs in the following line of code: >>> >>> session.prepareToPullChangesForEntityNames_beforeDate_(entityNames, >>> NSDate.distantFuture()) >>> >>> Where "session" is an ISyncSession object >>> (http://developer.apple.com/mac/library/documentation/cocoa/Reference/SyncServicesFramework/Classes/ISyncSession_Class/Reference/Reference.html#//apple_ref/occ/cl/ISyncSession), >>> and "entityNames" is a Python list of strings. >> >> What versions of Python, PyObjC, and OSX are you using? What's the full >> traceback? What is the value of entityNames? How do you create session? > > Hi Aahz! > > I'm building my app on a 10.5.8 system, with standard versions of > Python and PyObjC (2.5, and 2.0 respectively). I have not determined > if the errors occur on specific versions of OSX, but we QA the > application on both Leopard and Snow Leopard and internally we cannot > reproduce the problem (yet). > > The error posted is the full traceback. There is nothing else. > > The value of entityNames is *always* the following: > > entityNames = ['com.apple.contacts.Contact', > 'com.apple.contacts.Email Address', > 'com.apple.calendars.Calendar', > 'com.apple.calendars.Event', > 'com.apple.calendars.Recurrence', > 'com.apple.calendars.Attendee'] > > The session is created using > "ISyncSession.beginSessionWithClient_entityNames_beforeDate_". The > prepareToPullChanges... code would not be invoked if creating the > session returns a nil/None session object, or if it raises any > exception. I haven't used SyncServices for anything serious yet, which means I could be completely wrong with my assumptions. IIUC prepareToPullChanges... ends the phase where you push updates to SyncServices and starts the phase where SyncServices pushes changes to you. What kind of objects do you push to SyncServices? Are those pure Objective-C, instances of PyObjC subclasses or pure Python? The exception could occur when you push Python objects to SyncServices and SyncServices tries to serialize them using NSArchiver that doesn't support keyed coding, the code in Lib/objc/_pycoder.py assumes all archivers support keyed coding. Ronald |