pymel.tools.mel2py.mel2pyStr

static mel2py.mel2pyStr(data, currentModule=None, pymelNamespace='', forceCompatibility=False, verbosity=0, basePackage=None)

convert a string representing mel code into a string representing python code

>>> import pymel.tools.mel2py as mel2py
>>> print mel2py.mel2pyStr('paneLayout -e -configuration "top3" test;')
from pymel.all import *
paneLayout('test',configuration="top3",e=1)
<BLANKLINE>

Note that when converting single lines, the lines must end in a semi-colon, otherwise it is technically invalid syntax.

Parameters :
data : str

string representing coe to convert

currentModule : str

the name of the module that the hypothetical code is executing in. In most cases you will leave it at its default, the __main__ namespace.

pymelNamespace : str

the namespace into which pymel will be imported. the default is ‘’, which means from pymel.all import *

forceCompatibility : bool

If True, the translator will attempt to use non-standard python types in order to produce python code which more exactly reproduces the behavior of the original mel file, but which will produce “uglier” code. Use this option if you wish to produce the most reliable code without any manual cleanup.

verbosity : int

Set to non-zero for a lot of feedback

Previous topic

pymel.tools.mel2py.mel2py

Next topic

pymel.tools.mel2py.melInfo

Core

Core Modules

Other Modules

This Page