Setup for Python

return to main index


This tutorial explains how to set up a directory to store custom python scripts such that Maya can source them at start up. It is assumed the scripts will, in the main, be used in conjunction with Mel scripts specifically designed to work with Pixar's RenderMan for Maya (RfM). It is recommended the reader review the tutorial "RfM:Customizing" before applying the suggestions outlined in this tutorial. I am grateful to Fabio Piparo for helping me prepare these notes.

Listing 1 userSetup.mel (Windows & Linux)

if(`about -windows` || `about -linux`) {
    python("import sys");

Listing 2 userSetup.mel (MacOSX)

python("import sys");

Listings 1 and 2 show the Mel code for a file, named userSetup.mel, that should be saved in the maya/scripts directory. For example,








To confirm that Maya is executing userSetup.mel as anticipated, save the script shown in listing 3 into the RMS_python directory. Enter and run the text shown in figure 1 - ensure the Python tab is active! If no errors are reported the RMS_python directory has been set up correctly.

Listing 3 (

def isOK():
    print "Yes"

Figure 1

© 2002- Malcolm Kesson. All rights reserved.