python on mac (os x): application automation

Mitch Chapman mitchchapman at
Fri Sep 12 03:19:52 CEST 2003

Leo wrote:
> hi there
> i have just started with mac development and i use applescript at the moment
> for iTunes and iPhoto automation.
> but i'd like to do it from python. does anybody know weather  that's
> possible and if there is a add on for that?
> thanks, leo

Bob Ippolito has built aeve for just such purposes.
He recently announced aeve 0.0.3; you can find the announcement

Because I am lazy and do not read documentation :) I just downloaded
all of the source distributions from his website.  He also provides
binary distributions, which can be installed using PackageManager.

To build aeve for Python 2.3 from source, you'll need to
download and install each of these tarballs, using the usual
'sudo python install' incantations:

Bob's announcement includes sample code showing how to get the
name of the currently-playing iTunes track.  He also provided the
following variation, which works if you happen to be playing
no tracks:

#!/usr/bin/env pythonw
import aeve
iTunes = aeve.talkto('')
if iTunes.player_state == 'playing':
     print "iTunes is not currently playing a track"

Please also note that, in order to use aeve, you will
probably need to invoke python as pythonw (or run from within
a MacPython IDE) so you can talk to the window manager.


More information about the Python-list mailing list