While coding to obtain individual layers' attributes (field) list, I am stymied by the code.
I can identify a specific layer:
MyLayer = QgsMapLayerRegistry.instance().mapLayersByName("TestPoint")
which returns on "print MyLayer":
qgis._core.QgsVectorLayer object at 0x000000000FCC6730
from which I infer I am correctly using MyLayer as a Layer object/pointer (or whatnot...)
However, when I run this:
fields = Mylayer.pendingAllAttributesList()
I force this error:
AttributeError: 'list' object has no attribute 'pendingAllAttributesList'
Following this statement, eventually I would run a "For field in fields...:" indent block, to iterate through the fields, but I can't even get past my error.
I get same/similar errors for other attribute functions within the API, using versions provided in code samples, and best I can tell I am duplicating relevant python code within the samples found. Somehow, I am missing something important about the way the Attributes work, or the coding, or the list or object.
I am using the recently downloaded QGIS 2.6.0 package for windows.