3

I have a couple small projects that I want to use to learn python. What version should I be using if I want to move to scripting for Maya, Blender, etc later? Also, what resources are there for scripting for those programs?

meetar
  • 7,443
  • 8
  • 42
  • 73
jhultgre
  • 122
  • 1
  • 7

3 Answers3

5

If you are using Maya 2011 it comes bundled with and bound to py 2.6.4 already. You don't need a separate install, not even for pyMEL anymore.

If you want to learn Python on its own before applying the knowledge to a 3D app, then pretty much any 2.x Python will do really, the version specific features only come into play a while away if you're at your first steps. 2.6.4 though would of course be a good choice, as it will be aligned to what you might be using in Maya and Softimage right out of the gate.

Stay away from py3k for now as adoption in our field seems to be a long way away still.

As for resources, for Python and Maya together, close to nothing, but most of the programming oriented material I've seen published insofar, with only a handful of notable exceptions such as Gould's material, is usually between underwhelming and plain amateurish.

You're better off with a decent entry level book that doesn't assume the reader is drooling idiot (I still rate O'Reilly's learning Python very highly), sites like StackOverflow for idiomatic questions, and a lot of practice and browsing to make the necessary mental connection and exercise a bit when it comes to the specifics of the Maya scripting API.

Having a look early at pyMEL, since it's now bundled, also won't hurt. The default, old maya commands and mel wrapper-like modules are truly atrocious and as far from Pythonic as they could make them. pyMEL, while not 100% of the way there, has a stronger object orientation and doesn't read like a large population of monkeys was suddenly handled typewriters.

2

According to this post, Maya 2011 uses Python 2.6.4. Of course, earlier versions of Maya may well use earlier versions of Python, and vice versa (probably;-) for later versions of Maya (that do not yet exist AFAIK;-).

This page (which I can't read right now, maybe blender.org is down) shows that Blender 2.49b for Windows was built with Python 2.6, for Linux, Irix and Solaris doesn't say, for MacOSX for PowerPC requires Python 2.3, for MacOSX for intel 2.3 or 2.5.

If you want to try Blender 2.5.4 beta, see link text -- no mention of Python versions though.

"etc" is not the name of any "3d app" I've ever heard of.

IOW, the answer will depend on what version(s) of what 3d program(s) you want to use! Python 2.5 is pretty solidly guaranteed for reasonably recent Maya and Blender (except, for Blender 2.49b on MacOSC for PowerPC only, you're limited to Python 2.3); later versions of Python 2 strive to remain highly compatible with earlier ones, so even if you're on a 3d app based (say) on Python 2.6, as long as you know how to use Python 2.5 and stick to that you should still be fine (but not viceversa -- if you only know how to use Python 2.6, you may be in trouble when you need to do something in 2.5 or earlier;-).

Alex Martelli
  • 854,459
  • 170
  • 1,222
  • 1,395
  • Didn't know you had an interest in CG too Alex :) A few versions of maya back the version was less relevant as the bindings were rather primitive anyway. you could keep reasonably up to date separately from maya. 2009 and 2010 you want to go for 2.6, and 2011 you pretty much have the bundle rammed down your throat for you :) –  Oct 05 '10 at 02:17
  • 2012 still uses 2.6.4, at least.. that's what sys.version reports (# Result: '2.6.4 (r264:75706, Apr 14 2010, 12:23:05) [MSC v.1500 64 bit (AMD64)]' # ) – tanantish Oct 05 '12 at 11:48
2

I will say that there is no big difference for Python version. Just like others mentioned, ThE_JacO does not involved in popular 3D apps. Maya, Pixar's RenderMan, Houdini, Blender, Realflow, ... all have Python 2.x binding. For Python 2.4, 2.5, and 2.6, there is rare difference in function interfaces. You can just ignore this issue.

In our studio, we code Python scripts to work in 2.4, 2.5 and 2.6 because we uses different 3D apps version on different animation projects. There are some code snippets need modulation to make it all work well but they are really minor issues.

Drake Guan
  • 14,514
  • 15
  • 67
  • 94