pymel.tools.mel2py.mel2py

mel2py(input, outputDir=None, pymelNamespace='', forceCompatibility=False, verbosity=0, test=False, recurse=False, exclude=(), melPathOnly=False, basePackage=None)

Batch convert an entire directory

Parameters:
  • input – May be a directory, a list of directories, the name of a mel file, a list of mel files, or the name of a sourced procedure. If only the name of the mel file is passed, mel2py will attempt to determine the location of the file using the ‘whatIs’ mel command, which relies on the script already being sourced by maya.
  • outputDir (str) – Directory where resulting python files will be written to
  • 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
  • test (bool) – After translation, attempt to import the modules to test for errors
  • recurse (bool) – If the input is a directory, whether or not to recursively search subdirectories as well. Subdirectories will be converted into packages, and any mel files within those subdirectories will be submodules of that package.
  • exclude (str) – A comma-separated list of files/directories to exclude from processing, if input is a directory.
  • melPathOnly (bool) – If true, will only translate mel files found on the mel script path.
  • basePackage (str) – Gives the package that all translated modules will be a part of; if None or an empty string, all translated modules are assumed to have no base package.