Hi all, I am trying to do a string formatting in which it is in a
dictionary format that is to be used in mel command.
This is my mel command - `mel.eval('animLayerMerge{"BaseAnimation",
"my_layer"}')`
In my python format, I rewrote as this:
my_naming = 'my_layer'
command = '"{"BaseAnimation", "{0}"'.format(my_naming)
However this will results in the following error:
# Error: "BaseAnimation", "{0}"
# Traceback (most recent call last):
# File "<maya console>", line 2, in <module>
# KeyError: '"BaseAnimation", "{0}"' #
No matter how I wrote my `.format`, it will definitely errors out as soon
as I tried to incorporate in `{ {0} }` and the reason I am doing this is
because I would not want to hardcode the value of `my_naming` as it reads
from a text field which would means different naming.
Is there a better way that I can perhaps get around this?
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/7631674f-d987-45f2-9e9b-a48ae0c8c9d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.