simple tricky procedure: running python file from a mel file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Folks,
this is a simple basic question,
from a mel script how does one run a python file which includes maya python as well,
i did try various methods including running calling this command,
python (exec ("pathtoFile/ SaveLPLFile.py")); from mel does not work
and other methods that i had come across as well but nothing seem to work,
would be great to get a way which works with running python and maya python from mel file
ex:
mel script
AddLongAttribute( "JobPriority" );
if( GetCurrentRenderer() == "mentalRay" )
setAttr defaultRenderGlobals.deadlineJobPriority 60;
runThis.py
python script runThis.py
import maya.cmds
import os,sys
filepath = "/mnt/filePath/Maya/Check.txt"
def readFromFile()
fileOpenIn = open(os.path.join(filepath,'r'))
do something
fileOpenIn.close()
def setRenderer()
setRenderer = "renderman"
cmds.optionVar(sv=('preferredRenderer',setRenderer))
readFromFile()
if __name__ == __main__:
setRenderer()
Thanks,
Jay