[Pythonmac-SIG] Apple Events from MachO Python

Steven Majewski sdm7g@Virginia.EDU
Thu, 17 Jan 2002 21:07:04 -0500 (EST)


On Thu, 17 Jan 2002, Dan Grassi wrote:

> I'm wondering what the status of Apple Event support in the MachO (unix)
> version of Python?  Is this currently possible and if not is it on the
> radar?

 AE is one of the Carbon modules that's been ported, and I've already
discovered that AppleEvents *DO* work to/from unix command line
programs, so it ought to work.  'osascript' does it and I wrote
a C cmd-line program that sent and received AppleEvents.

 I believe with 2.2, the carbon modules get built but they don't get
installed, but if you copy them into a directory on the path
( plat-darwin ? I've been putting mine in site-packages/Carbon for now. )


2 differences I've noticed:

 Unix apps don't have a 4 char signature but it's worked for me
using the process name.

 Unix apps don't have an aete dictionary ( although, you can add one
with Rez and it won't at all interfere with the normal non-macish
operation. (I wonder if you can make a bundled App without it being
a GUI app ? ))


Another option:
  bill fancher <bfancher@mac.com> has an OSA Python ( Python as
a scripting addition to use instead of AppleScript ) ready for
testing.


 I was thinking about adding support for a DoScript AppleEvent to
Python so you could send it a python script. I wondered if there
are any synchronization problems: what happens when it gets the
DoScript AE when it's in the middle of executing a python script ?
I supposed this is similar to the case where you have some sort
of callback registered for a toolbox event. Are there any known
problems with this sort of async. dispatching ? ( I was going
to wait until I had time to poke around the source before I
brought this up, but as long as Dan has brought up the subject... )

( The C program I mentioned was talking to 'classic' XlispStat,
 which has a DoScript AE that evaluates a Lisp form and returns
 the answer as a string. )


-- Steve Majewski