Calling Mac programs from Python instead of from AppleScript

Python.Arno python at rgbaz.eu
Thu Mar 20 05:26:22 EDT 2008



On 19 mrt 2008, at 20:41, dvschorre at sbcglobal.net 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  
try

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

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

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


> 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:
http://www.autodesk.com/us/maya/docs/Maya85/wwhelp/wwhimpl/common/html/wwhelp.htm?context=DeveloperResources&file=Introduction_to_Maya_Python_API.html


> Thanks
> Dewey V. Schorre
>
gr
Arno Beekman



More information about the Python-list mailing list