Calling Mac programs from Python instead of from AppleScript

Python.Arno python at
Thu Mar 20 10:26:22 CET 2008

On 19 mrt 2008, at 20:41, dvschorre at wrote:
> When I'm running Script Editor, I can get Maya to draw a sphere by
> typing:
> tell application "Maya"
> 	execute "sphere"
> end tell
> When I try this using Python, I get this error message:
> IDLE 1.2.2
>>>> app('Maya').execute('sphere')
> Traceback (most recent call last):
>  File "<pyshell#0>", line 1, in <module>
>    app('Maya').execute('sphere')
> NameError: name 'app' is not defined
> Maybe I need to load some libraries first.

I never used applescript more than to record some clicks but you might  

tell application "/Applications/Autodesk/maya2008/Maya"

(replace maya2008 with you app's foldername)
or even

tell application "/Applications/Autodeks/maya2008/Maya/Contents/MacOS/ 

> Please help me to get started.
like any other VFX app, maya is also adding python libs
you can access MEL commands from a python library:

> Thanks
> Dewey V. Schorre
Arno Beekman

More information about the Python-list mailing list