[Pythonmac-SIG] unixy python and applescript

Bob Ippolito bob at redivi.com
Wed Aug 27 18:12:52 EDT 2003


On Wednesday, Aug 27, 2003, at 17:02 America/New_York, Chris Lee wrote:

> Hi All,
>
> I use an application called Pro Fit for graphing, data analysis and 
> some numerical analysis.  However I do most of my numerical work in 
> python and now I want to link the two :)
>
> What I am doing at the moment is using an applescript to get the 
> variables out of ProFit and then I am calling do script 'thescript v1 
> v2 v3....'
> I have a python function which extracts the variables and then returns 
> the result to applescript which in turn passes it back to Pro Fit.  It 
> all works just fine provided you have set up all your paths in 
> environment.plist file.  The problem of course is that it is very > slow.
>
> I know that Macpython can be linked directly with applescript but what 
> I really want to do is to allow the user to choose which python they 
> use (so they install the minimum of stuff to use it).  What modules 
> have to be installed for the UNIX pythons (either apple or third party 
> installed) to communicate with an applescript ?

Argh.. I don't recommend that idea.  Don't encourage people to use Fink 
python, and DEFINITELY don't encourage people to use Jaguar's python.  
If you're dead set on making it work on an arbitrary version of python 
on OS X, and since you're just using "do script" anyways, just bite the 
bullet and format a string to pass to osascript(1).

Panther's python will come with all the necessary modules for 
AppleScript.  I highly recommend taking a look at my aeve module ( 
http://undefined.org.python/ ) for any serious python <-> applescript 
interaction.  I'll be releasing a new version pretty soon that makes it 
more robust and cleans up all the terminiology finding junk I had 
stolen from gensuite.

Note that the setup.py in the current version of aeve is broken, add 
'aeve.aetypes' to the packages list before installing.

-bob




More information about the Pythonmac-SIG mailing list