how to pass arguments to maya.mel.eval()

203 views
Skip to first unread message

lala

unread,
Feb 26, 2014, 7:42:43 AM2/26/14
to python_in...@googlegroups.com


userSetup.py file takes precedence over userSetup.mel
so, i wanted to add some paths to "MAYA_SCRIPT_PATH" via python
this example for getting variables works fine
Code:
import maya.mel as mel import os.path import maya.cmds as cmds def printMayaPaths(): msp = mel.eval('getenv MAYA_SCRIPT_PATH') msp = str(msp) myList = msp.split(';') for each in myList: print each


but this one gives error
Code:
def addFolderToMayaPath(p): msp = mel.eval('getenv MAYA_SCRIPT_PATH') msp = str(msp) myList = msp.split(';') msp += ";" + p type(msp) mel.eval('putenv "MAYA_SCRIPT_PATH" ' + msp) maya.cmds.rehash()


QUESTION:
how exactly to add python list or path to MAYA_SCRIPT_PATH via python
huge thanks in advance everyone for time and suggestions and solutions
regards,lala

Marcus Ottosson

unread,
Feb 26, 2014, 9:25:41 AM2/26/14
to python_in...@googlegroups.com
Does this work for you?

>> import sys
>> sys.path.append('c:\path\to\scripts')

Alternatively

>> import os
>> os.environ['MAYA_SCRIPT_PATH'] += ';c:\path\to\scripts'


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/434728f1-4a8d-442c-8b2d-76b16349dbc2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Marcus Ottosson
konstr...@gmail.com

lala

unread,
Feb 26, 2014, 9:40:57 AM2/26/14
to python_in...@googlegroups.com
yes alternative solution works. thanks for sharing..
Reply all
Reply to author
Forward
0 new messages