Do not rename glyphs when reading UFO from disk

In my workflow, I am relying on a script which reads UFOs and opens them in GlyphsApp. I am using code like

sf = Glyphs.open(ufo_path, showInterface=False) 

Unfortunately, after the current 3.4 update, the glyphs within the UFO are renamed to “nice” names, which causes the rest of my script to fail. (This is independent of the UI setting “Keep glyph names from imported files”, which does not seem to have any effect for me.)

The script worked fine in Glyphs 3.3.1.

I can see that the font object has a disablesNiceNames attribute, but how can I set that before the font object itself is created? (sf in the example above).

Would something like this be possible?

sf = Glyphs.open(ufo_path, showInterface=False, disableNiceNames=True) 

I fixed this. But it is now again checking the setting in Preferences.

Thank you for the update. Unfortunately, this means that my script is not reliable – it will work on one setup not the other. I also don’t think that UI settings should really influence the result of a script.

Is there really no way to tell Glyphs “read this UFO without changing glyph names”, via code?

Adding that option would need to change a lot of the process. I’ll see what I can do.
For now, you could set the defaults in script (and reset it afterwards).

May I ask what you are trying to do?