[Pythonmac-SIG] AEType

has hengist.podd at virgin.net
Wed Oct 26 01:30:16 CEST 2005


Zhi Peng wrote:

> I often get type error when I pass some parameters inside a function while I am using appscript MacPython. I saw some documents mentioning sth like AEType('sf '). What does it mean? Anyone knew?

The AEType class is defined in the aem package that underpins appscript, and represents (not surprisingly) an AE type as used by the Apple Event Manager. Appscript normally converts AEType instances to attributes of its k namespace, e.g. aem.AEType('long') -> k.Integer, but every so often it'll encounter one whose code it doesn't recognise (i.e. not defined in the application's dictionary or in appscript's built-in tables) so it'll just pass it on as-is. (In AppleScript, the equivalent raw representation looks like <<class CODE>>.) See the 'Classes and Enumerated Types' chapter of appscript's manual and the aem documentation for more info.

The 'sf  ' code you mention is a pseudo-type defined in the AppleScript component that's only used [AFAIK] in aete resources, where it translates as 'alias or string'. It's a kludge used to get around the aete format's inability to specify multiple types for a single property/argument. Appscript doesn't bother mapping this to its k namespace (not unless an application defines it itself), but the help system in the latest source release does now display it as 'Alias | String' instead of "AEType('sf  ')".

As for the type errors you're getting, you'd really need to provide some example code and tracebacks for a definite answer as it might be related or could be something completely different.

has
-- 
http://freespace.virgin.net/hamish.sanderson/


More information about the Pythonmac-SIG mailing list