Problem with annnotations in script

I don’t understand what I’m doing wrong. If someone can help me please, thanks.

font = Glyphs.font

for glyph in font.glyphs:
	for layer in glyph.layers:
		for annotation in layer.annotations:
			print(annotation)

Traceback (most recent call last):
  File "<macro panel>", line 5
  File "GlyphsApp/GlyphsApp/__init__.py", line 358, in __iter__
TypeError: 'NoneType' object is not iterable

You need to use layer.annotations.values() instead of layer.annotations. Not sure whether the documentation needs to be updated or the Python API, will look into it.

1 Like

I fixed it.

1 Like