Pymel ls command does not return full path names



As i’m working on an inhouse exporter script, i stumbled over a peculiar problem with PyMel. The pymel version of the ls-command seems to ignore the long parameter, while the maya.cmds version works correctly:

import maya.cmds as cmds
for x in, l=True):
    print x



from pymel.core import *
for x in ls(sl=True, l=True):
    print x


Am i doing something wrong here or is this actually a bug? Has anyone encountered that problem?


In PyMEL, returns you PyNode objects, not strings - which is what does

From the docs:

- Returns PyNode objects, not “names” - all flags which do nothing but modify
the string name of returned objects are ignored (ie, ‘long’); note that
the ‘allPaths’ flag DOES have an effect, as PyNode objects are aware of
their dag paths (ie, two different instances of the same object will result
in two unique PyNodes)

Key bit here is: “PyNode objects are aware of their dag paths” :slight_smile:


Right on, my mistake, now i feel stupid :smiley:

A little research in the docu also showed me how i get the full name:

print ls(sl=True)[0].longName()