k, i thought that there might be something like this going on. you need to use MSyntax and MArgParser parse flags for your command. you cannot parse the flags yourself if you want the command to work both in MEL and python.

-chad




On Jan 15, 2010, at 11:35 AM, chrysl666 wrote:

cos happens another weird strange RunTimeError


maya.cmds.cacheDeform(ts=True, p="c:/teste")
# Error: Path must be provided with -p (-path) flag.
# Traceback (most recent call last):
#   File "<maya console>", line 1, in <module>
#   File "<string>", line 2, in cacheDeform
# RuntimeError: Path must be provided with -p (-path) flag.
#  #

maya does not understand my "p"  flag

same command using mel :

cacheDeform -ts -p "c:/teste";
// Successfully wrote deform cache file for all objects //


 .. tnxs again for help me !



On Fri, Jan 15, 2010 at 5:27 PM, Chad Dombrova <[email protected]> wrote: i wonder if there is some strange code in the plugin regarding a result set by MPxCommand.setResult() that works in MEL but cannot be converted into a python object by mel.eval?

but still, why not call this command from maya.cmds as chris suggested?

maya.cmds.cacheDeform(ts=True, p="c:/teste")


On Jan 15, 2010, at 11:22 AM, chrysl666 wrote:

Tnx folks for help me unhappy the problem isn`t the "/"character nor the single quoting

another test with the suggestions


#
doCreateCacheCommand = 'cacheDeform -ts -p "c:/teste"'
mm.eval(doCreateCacheCommand)

#maya return

mm.eval(doCreateCacheCommand)
// Successfully wrote deform cache file for all objects //
# Error: Error occurred during execution of MEL script
# Traceback (most recent call last):
#   File "<maya console>", line 1, in <module>
# RuntimeError: Error occurred during execution of MEL script #


again the plugin works but after end its functions . maya return a error !



On Fri, Jan 15, 2010 at 4:29 PM, Richard Kazuo <[email protected]> wrote: The single/double quoting could do the job, but in my local test the escape character "\" works.

//MEL
global proc createSphere(string $name){
sphere -n $name;
}

#PYTHON
import maya.mel as mel

cmd = "createSphere \"test\""
mel.eval(cmd)


I tested this with a simple function - perhaps custom commands with flags work differently...


Richard



On Fri, Jan 15, 2010 at 3:52 PM, damon shelton <[email protected] > wrote: in python strings the \ character represents a continue line (meaning: the string is continued on the next line)
when making a command string in python you can write it this way

doCreateCacheCommand = 'cacheDeform -ts -p "c:/teste";'

the string is wrapped in single quotes with double quotes inside the string not being evaluated util eval call is made on them

I can not test if this is your fix but it looks like it

-Damon

On Fri, Jan 15, 2010 at 8:48 AM, chrysl666 <[email protected]> wrote:
I got some problems when I call Mel commands from Python . always I
got some return error

some examples :


import maya.mel as mm
doCreateCacheCommand="cacheDeform -ts -p \"c:/teste\" "
mm.eval(doCreateCacheCommand)


// Successfully wrote deform cache file for all objects //
# Error: Error occurred during execution of MEL script
# Traceback (most recent call last):
#   File "<maya console>", line 3, in <module>
# RuntimeError: Error occurred during execution of MEL script #

this plugin is wrote using c++ API e create "cacheDeform" mel command
when it is called using python  it works well  , but after  it ends
its functions I`ve got a RuntimeError

as you can see in :

// Successfully wrote deform cache file for all objects //

the plugin is working


when a call it usin only MEL I got no return error

cacheDeform -ts -p "c:/teste";
// Successfully wrote deform cache file for all objects //




I have another question . is it possible create python commands using
API  Mfn  instead mel commands ?


--
http://groups.google.com/group/python_inside_maya


--
http://groups.google.com/group/python_inside_maya


--
http://groups.google.com/group/python_inside_maya

--
http://groups.google.com/group/python_inside_maya


--
http://groups.google.com/group/python_inside_maya

--
http://groups.google.com/group/python_inside_maya

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to