Dec 22

More Maya Python fun

This is in addition to what I said below but I found a little better interactive shell that ships with wxPython called PyCrust.
Go to and download the win32-ansi for Python 2.5 and the “docs and demos” too. This will get you the PyCrust. Just let everything install in default locations and say yes to compile the packages.

No goto your Programs->wxPython2.8 docs and demos->PyCrust.
You should get this.

Now lets interact with Maya.

import maya.standalone

As soon as you do you start to see this:

You get some nice info from Maya and using this in an external editor.

Now type:
import maya.cmds as cmds

You should now have auto-complete showing you the command. Pretty cool, eh?

Yea, I wish it would show the flags associated with the command.
Now this not really a full editor. It’s just an interactive shell but you could quickly proto-type something in PyCrust and port it over to your editor that is your main script. If you goto the history tab you can quickly copy/paste your chunk of code back over to your editor. This is just a great way to test something out without having to launch Maya up.

5 Responses

  1. MaxtorAG Says:

    Hi Sean Nolan!
    Pretty awesome blog you got here!
    Are you just starting with Python in Maya? I am thinking of going that way too. I was hoping to avoid the C++ API and just get along with MEL and Python.
    Is there a good learning source for Maya Python API that you use and could recommend?

  2. admin Says:

    Hi there!
    Yea, been dabbling a bit with Python in Maya and it sure has been a great addition. I haven’t found any sources yet that deal with Maya Python API directly but there are a couple of Maya books that talk about the API in C++. The Maya docs have some really good examples and there are some sample Python scripts that utilize the API. So my first suggestion would be to really learn Python and understand the fundamentals and then dive into the API. If you try and do both you’ll just get confused…I know I did :).

    Good place to start with API stuff would be to check out David Gould’s books.

  3. MaxtorAG Says:

    Thx. I will check out that book. But can you give me an advice in this?: I am trying to choose which API to learn (don’t have any experience neither with C++ nor with Python, just MEL). Do you know which plug-ins (C++/Python) are easier to compile? And whether I will have any advantage knowing Python over C++ within todays apps (I know XSI and Blender also utilize Python)? Just curious about your opinion.

  4. admin Says:

    If you feel comfortable with MEL then Python will make more sense than C++. Python scripts just run and don’t need to be complied like C++ plugins do. So if you want to prototype something quickly then Python is good for that.

    Python is getting to be much more widely used and incoporated into studio pipelines. Certaninly knowing C++ will help but isn’t really needed. I’ve created some very simple Python scripts here at work that have really helped that I could have done in MEL and would be an overkill if it was done in C++.

    I think Python would be easier for you to get if wanting to know more object-oriented languages.

    I hope that answers your question.

  5. MaxtorAG Says:

    You certainly did answer my question and even to my satisfaction. Not only I don’t need to buy another book, but also the trend is going the way I was hoping for.
    And I am looking forward to see some more info in your blog.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.