(Mac-specific) AppScript bug

George van den Driessche grebe at bigfoot.com
Thu Dec 23 02:46:41 CET 2004


(This is really for Hamish Sanderson, I think, but I can't find an 
e-mail address for him.)

On OS X 10.3.7, with XCode 1.5 and all the latest AppScript packages 
installed, writing this:

  a = appscript.app( 'XCode.app' )

causes a crash in terminology.py:

/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/appscript/terminology.py 
in parse(self, path)
    102                 osat.parse(path, self)
    103                 for code in self._elements.values():
--> 104                         name = self._pluralClassNames.get(code, 
self._singularClassNames[code])
    105                         self.referencebycode[code] = (kElement, name)
    106                         self.referencebyname[name] = (kElement, code)

KeyError: '****'

code is a FourCC identifying some part of XCode's script interface. You 
would imagine that every such part would have either a plural name or a 
singular name, but in this case somehow the FourCC '****' has ended up 
in self._elements and it has neither. Any idea how that might arise? I 
didn't investigate the origins of the FourCC, which looks like a 
placeholder or error.

 If you change the marked line (104) to read:

  			name = self._pluralClassNames.get(code, 
self._singularClassNames.get(code, '____'+code))

then the rest of the terminology seems to run fine, and you just end up 
with one bogus entry called '____****' in the app's attributes.

Cheers,
George




More information about the Python-list mailing list