Hi, You are doing it correctly. What you are getting is a list of string (Unicode actuslly) results. The Maya commands api, just like the MEL counterpart, uses string paths to all object references.
If you are expecting a 1st node object, then you are probably thinking of the PyMel api which is an abstraction over the native Maya API to provide something more pythonic and object oriented. The Maya API (derived from the C++ counterpart) also is more object oriented that the commands Mel api. Basically, if you use the Python commands api, you pass around strings. On Wed, 12 Nov 2014 9:46 PM yann19 <[email protected]> wrote: > Hi all, I just started learning Python and currently I am confused about > some stuff in Maya. Please do bear with me and my noob questions > > I am selecting on an object in which it is called pCube1 and so I run the > following code: > sel = cmds.ls (selection = True) > print str(sel) > > However, here I thought I am supposed to get the output result as pSphere1 > in my editor but yet I am seeing [u'pSphere1'] instead. > > Or am I doing it in the wrong way to grab the object name? > > -- > 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/3d317cc5-4a5f-424a-9cb3-7ac5af4c040a%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/3d317cc5-4a5f-424a-9cb3-7ac5af4c040a%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAPGFgA03fJtg%3DurGGaVzsJA49%3Dq-smVyyW2W3ONRjVOFV5Kqsw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
