The aepack module defines functions for converting (packing) Python variables to AppleEvent descriptors and back (unpacking). Within Python the AppleEvent descriptor is handled by Python objects of built-in type AEDesc, defined in module Carbon.AE.
The aepack module defines the following functions:
|Python type||descriptor type|
|integer||typeLong (32 bit integer)|
|float||typeFloat (64 bit floating point)|
If x is a Python instance then this function attempts to call an __aepack__() method. This method should return an AEDesc object.
If the conversion x is not defined above, this function returns the Python string representation of a value (the repr() function) encoded as a text descriptor.
line 3 of document 1) are returned as instances of aetypes.ObjectSpecifier, unless
formodulenameis specified. AppleEvent descriptors with descriptor type typeFSS are returned as FSSpec objects. AppleEvent record descriptors are returned as Python dictionaries, with 4-character string keys and elements recursively unpacked.
formodulename argument is used by the stub packages
generated by gensuitemodule, and ensures that the OSA classes
for object specifiers are looked up in the correct module. This ensures
that if, say, the Finder returns an object specifier for a window
you get an instance of
Finder.Window and not a generic
aetypes.Window. The former knows about all the properties
and elements a window has in the Finder, while the latter knows
no such things.