What is the way to remove a contour using Python?

Hey, my code is derived from what I found in the documentation.

for glyph_name in {"A", "B"}:
   for layer in font.glyphs[glyph_name].layers:
       del layer.paths[i]

But it throws an error

TypeError: 'GSProxyShapes' object doesn't support item deletion

What is the way to remove a contour using Python?

Use layer.shapes. It contains paths and components, so you might need to adjust your index.

1 Like