Batch Exporter using Maya Standalone

Tonight I spent a few hours experimenting with Maya standalone module from the external Python interpreter. Digital Tutors has a video tutorial on bit of this, however I couldn’t get it to work following exactly what the tutor did. It threw out this error:

ImportError: DLL load failed: The specified module could not be found.

After some research I finally figured it out. Besides setting the following two environment variables:
PYTHONPATH
C:\Program Files\Autodesk\Maya2013\Python\Lib\site-packages
MAYA_LOCATION
C:\Program Files\Autodesk\Maya2013

Make sure PATH also knows where Maya is…if not just add %MAYA_LOCATION% to it.

Then we get to import Maya standalone module:

For testing purposes I created files in a nested folder structure:

Then batch export:

Not sure if I did things the right way…because using¬† fileNameA[:-3]¬†does seem a very weird way to me to get rid of the “.ma” extension. If you are reading this and think “Nooooo! You totally shouldn’t do it that way!!!”, please do let me know the right way! :D

2 Comments

  1. Kim

    Hi Jing!

    Any idea why maya.cmds does not load for me using Maya standalone?
    This errors “undefined variable from import: group”:
    (And so do all other commands under cmds)

    [code]
    import maya.standalone
    import maya.cmds as cmds

    maya.standalone.initialize(name=’python’)
    cmds.group()
    [/code]

    Thanks!
    -Kim

Leave a Reply