No module named 'objc'

glyphs’ python set to Homebrew’s Python 3.9.1, inspecting this python via freeze tells me that pyobjc is installed and can be imported when using python seperately outside of Glyphs

3097

Can you check what version of python is selected in Preferences > Addons?

  • does it work if you set it back to the Python from plug-in manager?
  • which code triggers the error? import objc?

Yes… I checked that I have the correct version chosen.

It tells that it’s Homebrew version of Python when in fact it’s Pyenv and Pyenv itself is installed via Homebrew. I find it a bit confusing.

Using Glyphs’ Python doesn’t help.

running this

print("hi")
import os
print("hello")

interestingly returns this

Traceback (most recent call last):
  File "<internal>", line 1
ModuleNotFoundError: No module named 'objc'
hi
hello

Are you sure you are using Glyphs’ Python? There should be the text “(Glyphs)” at the end of the version number in GlyphsPreferences…Addons and you need to restart Glyphs after switching version.

When you run a script, a bit of code is run to set things up correctly. That is causing the error message.
what do you get when you run this:

import os 
print(os)

Yesterday, I found that installing Python from the Plugin Manager did not install any Python with “(Glyphs)” as I hoped.

In preferences, I could only choose Homebrew Python 3.9.1, so I thought that’s the one I am supposed to pick. I don’t remember ever having installed Homebrew Python 3.9.1 but I am not 100% sure. It just seems like a funny coincidence that this exact version is causing problems for another user.

Did you restart Glyphs after you installed the Module?

I think I did re-start Glyphs but I am not 100% sure.

Btw, that potential problem could be avoided if Glyphs simply re-started automatically whenever applicable (including installing plug-ins), as I have requested many times for many years. “Did you restart Glyphs?” is my own standard response if users report problems with RMX or Kern On and it’s really unnecessary we have to deal with that question all the time.

Just make Glyphs re-start by itself, then we’ll have less hassle with support and happier users!

Thank you for your explanation, there is (Windows Store)

Your Python version is ending in “(Windows Store)”? In that case select the one ending in “(Glyphs)”. If the menu has no option ending in “(Glyphs)”, open the Plugin Manager, go to the Modules tab and download Python. Restart Glyphs and the “(Glyphs)” option should be selectable. Restart Glyphs again to load the new Python version.

1 Like

can you send a screenshot where you see the “Windows Store”?