Can not import libdispatch

I can not import the PyObjC module libdispatch. Is only a subset of PyObjC modules supported by Glyphs? Or is my installation at fault? Some modules work (AppKit, WebKit, …) and some don’t (CoreText, libdispatch, …).

Glyphs 3.0.3 (3061), macOS 11.2 (20D64), Python: 3.8.2 (Glyphs) [from Plugin Manager]

The module is simply not in the package. I updated the plugin (that will need 3062) to include the full python installation (and being 2.5 times as big).

The Python “Module” from the Plugin Manager? Or some other Glyphs plugin?

The idea is to use libdispatch from a plugin, but currently I can not evaluate whether that is a good idea or not. So even if libdispatch is available and I evaluated its effectiveness, I might decide against using it. So, I don’t need libdispatch if 2.5× ends up been a lot of MB.

Thank you very much for considering and implementing this!

I’m not adding modules manually I just pick whatever is in the default installation. And I’m speaking about the GlyphsPythonModule. And you can test it already. You probably need to remove and reinstall ‘Python’ from the modules in plugin manager.

I installed 3.0.3 (3062).

I removed Python from the Plugin Manager and once the green install button was shown next to “Python” I clicked install. This alert was shown:

I removed Python again and installed it again, no alert. Now a GlyphsPythonPlugin directory sits in Glyphs’s “Repositories” directory with 81.2 MB.

I quit Glyphs and re-launched it. Running

import objc
import libdispatch

in the Macro window still fails:

Inside GlyphsPythonModul.glyphsPlugin I see these dynamically loadable libraries:

What version of python do you get inside Glyphs?
And the dynamic libs have nothing to do with the module (I think).

Is that module available when you install python from

I get 3.8.2:

import libdispatch works if I select the Python from Homebrew, presumably this also applys to downloading it from

What version of Glyphs do you have?

3.0.3 (3062)

can you try to remove the GlyphsPythonPlugin from the repo folder again and re-install it? It should work now. You should see “3.9.1 (Glyphs)” in the python settings.

I deleted GlyphsPythonPlugin and now Glyphs crashes. (Report).

Than I ran this line from the Terminal:

defaults delete com.GeorgSeifert.Glyphs3 GSPythonFrameworkPath

Re-launched Glyphs again, crashes again. Launching in no-plugin mode works and I have send a Glyphs report with the comment “Note-1”.

Just tested the plugins: All my plugins work if I remove just GlyphNote. But just GlyphNote, no other plugins, works, too. It also works with all but SpaceBar, adding SpaceBar crashes.

I could reduce it to:

  • GlyphNote.glyphsPalette
  • Noodler.glyphsFilter
  • OptimizeStartNodes.glyphsFilter
  • SpaceBar.glyphsReporter
  • SpeedPunk.glyphsReporter
  • VizBez.glyphsReporter

Just these crash Glyphs, remove any one and it works.

Now I launched Glyphs with a safe subset and installed Python again from the Plugin Manager and selected it in the preferences (Python version “3.9.1 (Glyphs)”). Now Glyphs launches again with all Plugins.


import objc
import libdispatch

runs fine, but it crashes Glyphs if there are plugins installed. (Send a report with note “libdispatch”). Each of my plugins, if installed individually, works with the two lines above.

Again, I reduced it to this set of plugins:

  • GlyphNote.glyphsPalette
  • OptimizeStartNodes.glyphsFilter
  • SpaceBar.glyphsReporter
  • SpeedPunk.glyphsReporter
  • StemThickness.glyphsReporter
  • VizBez.glyphsReporter

(While reducing I send reports with the note “Reduce”.)

With this set, the two imports above in the Macro window crash Glyphs. Remove any one and run the two imports from the Macro window and it does not crash.

My versions are still the same: Glyphs 3.0.3 (3062), Python 3.9.1 (Glyphs), macOS 11.2 (20D64)

If libdispatch is too much work to implement I am also fine with it not shipping with the Glyphs Python. Preliminary tests show that parallelism in Python is – unsurprisingly – not great, even when using Apple’s GCD infrastructure.

implementing libdispatch is not a problem as it is already there. The crash with the plugins is probably the same problem we had before because one of the plugins is not updated. I’ll have a look. Can you send me the script you use the crash Glyphs?

It’s just the two import lines from above:

import objc
import libdispatch

No actual code needed for the crash. I ran the lines from the Macro window.

I checked the plugins you mentioned and some of them don’t have the updated binaries, yet. So a crash like this is to be expected.
So libdispatch should work fine if only up to date plugins are installed.

I see, thank you for investigating the issue. Can I safeguard the import in my plugin such that if the import fails Glyphs does not crash but instead gracefully falls back to a non-libdispatch solution?

I tried tryexcept but this still crashes Glyphs if non-updated plugins are installed:

import objc

	import libdispatch
	print("OK, use libdispatch")
	print("resorting to fallback, no libdispatch for you")

The problem is that the plugins cause a memory corruption that only shows up much later. That’s why it took so long to find. All later safeguards (try/except) dont help with issues like that.

The only thing you can do us to check if all plugins you have installed have beed updated in the last week.