Cannot add a new layer

When I try to add a new layer via Python using the exact same code that’s in docu.glyphsapp.com, I get the following traceback error in other people’s machines (works in mine): GlyphsLayerProxy has no attribute “append”

Can anybody explain how to solve this?

You mean this one:

# add a new layer
newLayer = GSLayer()
newLayer.name = '{125, 100}' # (example for glyph-level intermediate master)
# you may set the master ID that this layer will be associated with, otherwise the first master will be used
newLayer.associatedMasterId = font.masters[-1].id # attach to last master
font.glyphs['a'].layers.append(newLayer)

Yes, that one. An attempt to append any layer to a glyph. It works in my machine, not in others.

The error sounds like you are trying to append to a single layer rather than the layers of the glyph.

Make sure they all have the latest version.

My colleague has 778 and it doesn’t work there. I literally copied and pasted the same code from the documentation page and it failed. And again, the code works for me, so I don’t think it’s a syntax error.

See if they have a glyphsapp.py or .pyc files in their Scripts folder and delete them.

Ah, that thing again. Yes it’s working now. Thanks!