By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,772 Members | 919 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,772 IT Pros & Developers. It's quick & easy.

Calling Mac programs from Python instead of from AppleScript

P: n/a
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.

Please help me to get started.

Thanks
Dewey V. Schorre

Mar 19 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
dv*******@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.

Please help me to get started.

Thanks
Dewey V. Schorre
Take a look at appscript:

http://appscript.sourceforge.net/

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
Mar 19 '08 #2

P: n/a


On 19 mrt 2008, at 20:41, dv*******@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...ython_API.html

Thanks
Dewey V. Schorre
gr
Arno Beekman
Mar 20 '08 #3

P: n/a
has
On 19 Mar, 20:10, Kevin Walzer <k...@codebykevin.comwrote:
Take a look at appscript:

http://appscript.sourceforge.net/

Also, once appscript is installed, don't forget to import it before
use:

from appscript import *
app('Maya').execute('sphere')
HTH

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

Mar 20 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.