Sure, on the mac, i use the default dir "/Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/pymel-1.0.0- py2.6.egg/pymel/tools/mel2py"
In the company, we put the pymel-1.0.3 on the server, just like this " <module 'pymel' from '\\server-epic01\WorkflowTools\Epic\lib\pymel\pymel-1.0.3\pymel\__init__.py'> " when i import the module mel2py, i get a warning from all of them import pymel.tools.mel2py as mel2py # pymel.core : Updating pymel with pre-loaded plugins: OpenEXRLoader, > DirectConnect, studioImport, mayaHIK, Mayatomr # > # pymel.core : Updating pymel with pre-loaded plugins: OpenEXRLoader, > DirectConnect, studioImport, mayaHIK, Mayatomr # > # WARNING: No t_error rule is defined > # WARNING: Token 'COMMENT_BLOCK' defined, but not used > # WARNING: Token 'COMMENT' defined, but not used > # WARNING: There are 2 unused tokens > # WARNING: no p_error() function is defined > # WARNING: Symbol 'element_list' is unreachable Y?Y?Y? 2011/7/25 Count Zer0 <[email protected]> > Sounds like you may have a bad PyMEL install. Can you 'point' to the > one in your Autodesk install dir? Import that one? or you can download > 1.0.3 from google code and put it somewhere else and add that path to > your pythonpath and import that one. The latest 1.0.3 should have a > working mel2pyStr method. > > On Jul 24, 7:27 am, 张宇 <[email protected]> wrote: > > Thanks guys,i begin to understand why should do it like this, but there > is > > another problem about the mel2py, i execute the code > > > > > import pymel.tools.mel2py as mel2py > > > > > pythonCode = mel2py.mel2pyStr("connectAttr -force anim.rotate > > > anim_md.input1") > > > > it raised an error > > > > > # Error: script has no contents > > > # Traceback (most recent call last): > > > # File "<maya console>", line 1, in <module> > > > # File > > > > "/Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framew > ork/Versions/Current/lib/python2.6/site-packages/pymel-1.0.0-py2.6.egg/pyme > l/tools/mel2py/__init__.py", > > > line 431, in mel2pyStr > > > # results = mparser.parse( data ) > > > # File > > > > "/Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framew > ork/Versions/Current/lib/python2.6/site-packages/pymel-1.0.0-py2.6.egg/pyme > l/tools/mel2py/melparse.py", > > > line 2629, in parse > > > # raise ValueError, msg > > > # ValueError: script has no contents # > > > > i don't know why, yeah, i remember this, i had installed this plugin > follow > > the maya help, but it's also wrong like this, i was the first one > download > > the pymel-1.0.3 ,and i replace the file in the folder mel2py, but it's > also > > wrong, i don't know why??????????? > > > > 2011/7/21 PixelMuncher <[email protected]> > > > > > > > > > > > > > > > > > > > > > In the script editor, I keep a tab for mel to Python conversion. > > > You can convert a whole script or just some code. > > > The tab has this code: > > > import pymel.tools.mel2py as mel2py > > > # Beware escaped chars - \t needs to be \\t > > > mel2py.mel2py("C:\Documents and Settings\Administrator\My Documents > > > \maya\myscripts\\tf_animCurve2drivenKey.mel") > > > > > mel2py.mel2py("C:/Program Files/Autodesk/Maya2012/scripts/others/ > > > advanceToNextDrivenKey.mel") > > > > > pythonCode = mel2py.mel2pyStr( """ > > > connectAttr -force anim.rotate anim_md.input1; > > > """) > > > print pythonCode > > > > > To convert a whole script, replace the path inside the quotes, ie C: > > > \Documents... > > > The converted script will be placed in the same dir. > > > > > To convert code, replace the code in the lines between the triple > > > qoutes and the converted code will be saved to the pythonCode var. > > > Sometimes you need to cleanup the code, but its VERY USEFUL > > > nonetheless. > > > > > -- > > > view archives:http://groups.google.com/group/python_inside_maya > > > change your subscription settings: > > >http://groups.google.com/group/python_inside_maya/subscribe > > > > --http://thatboy.me > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > -- http://thatboy.me -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
