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, …).
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 needlibdispatch 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.
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.
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.
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?
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 try–except but this still crashes Glyphs if non-updated plugins are installed:
import objc
try:
import libdispatch
print("OK, use libdispatch")
except:
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.