Glyph export fails due to improper character in anchor name

That’s what the dialog says. I can’t find the anchor. I cleared all the paths, tried to drag-select a very wide area to try to select and delete the anchor but couldn’t find one; at any rate didn’t manage to remove the error.

Is a specific glyph/layer mentioned?

Can you run the following code in the Macro Panel with the glyph in question open in Edit view:

for layer in Layer.parent.layers:
    for anchor in layer.anchors:
        print(anchor.name)

Please post the result from the console here.

Hi Sebastian, yes, it mentions a specific glyph. I’m trying what you’re saying in a few minutes

I need to install Python 3 whch fails due to “Failed to get HEAD (unborn)”

Anchors are the reddish dots, has nothing to do with the paths.

Yes, I use them, but there are no anchors I can see/find/select on my glyph. I cleared the paths just to make sure I could see everything clearly

Do you have View > Show Anchors activated?

For the “failed to get HEAD” error, there are a few threads in the forum explaining how to fix this.

Yes, because I do use anchors quite a bit. Also tried resetting anchors

Can you maybe attach a test file here (with only one of the glyphs in question, if that still leads to failing export)?

trying this

I have sent the file to support@glyphsapp.com, marked to Georg and you, I hpe that’s ok, couldnt figure out howthe send the file with just /E. thanks. It’s the E that’s offending; it was /K in an earlier version

The anchor was in a component, not in the “E” directly.

Yes, I did find and delete all occurrences of “new anchor”. Wondering why this name is bad or what character in it is since these names are assigned by the application? .@sebastian maybe you could write a script that deletes “new anchor” as a fix? @GeorgSeifert Your points about tidy paths etc are well made and well taken—that was my first encounter with Glyphs .

Thanks both

for glyph in Font.glyphs:
    for layer in glyph.layers:
        layer.removeAnchor_(layer.anchors["new anchor"])

Didn’t test this, but should work. Will remove all anchors in the font named “new anchor”.

Anchor names, like glyph names should not contain spaces.

Should be great! WIll try once I can re- install the Python module (used to work, then womthing happened). Thank you.
Is .removeAnchor a part of Glyphs-specific python, and is there a guide to the syntax/cookbook somethong similar? I have read the pythin tutorials a year or so ago.

Yes the error message does say that come to think of it, thank you

Not everything is documented. You can use the mekkablue script “Method Reporter” to find all methods for a class.

that uses the objectiveC API directly (Some of it is document in the “Core” part on the docu page).
The python syntax is like this:

del layer.anchors["new anchor"]