(Mac-specific) AppScript bug

  • Thread starter George van den Driessche
  • Start date
G

George van den Driessche

(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
 
H

has

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

No worries. (Email addy is buried in appscript-0.7.1 > Manual.txt >
Authors, though some releases listed a duff address which certainly
didn't help. Better documentation is on my TO-DO list.)

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: [...]
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?

Sounds like a bug in XCode's terminology resource. I'd need to see the
raw terminology to say for sure. If you want to use the
osaterminology.tools.quickdoc module to dump it to text file and send
if over I'll take a look.

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.

Appscript-0.9.0 does this. Should be ready in another few days - I'll
post when it's out. Buggy terminology resources are unfortunately a
fairly common problem, and I'm still figuring out how best to deal with
them. Welcome to the wonderful and wonky world of Mac application
scripting. :p

HTH and thanks,

has
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,787
Messages
2,569,629
Members
45,332
Latest member
LeesaButts

Latest Threads

Top