Exporting UFOs with Python fails with error

Glyphs 3.0.4 (3105)

I can’t tell if I’m doing something wrong here, but trying to export each master as UFO and I get the error

objc.error: NSInternalInconsistencyException - enableUndoRegistration: GSUndoManager 0x60073ae61e00 is in invalid state, enableUndoRegistration may only be invoked with matching call to disableUndoRegistration

Where it happens is inconsistent. Sometimes it will happen with the first master, but sometimes it will get through a couple masters first and then error.

ufoExporter = Glyphs.objectWithClassName_("GlyphsFileFormatUFO")
ufoExporter.setConvertNames_(False)
exportFolder = '/some/path'
for master in font.masters:
	ufoExporter.setFontMaster_(master)
	url = NSURL.fileURLWithPath_(os.path.join(exportFolder, master.name + '.ufo'))
	ufoExporter.writeUfo_toURL_error_(master, url, None)

It works for me. Could you send me the file that causes this?

Thanks. Sent an email.