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