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”?

August 2024 Response:

The steps in Troubleshooting > Python does not install helped me resolve the “No module named ‘objc’” error.

  1. Run Script > Open Scripts Folder to access the Application Support folder of Glyphs.
  2. In the folder that opens in Finder, navigate to RepositoriesGlyphsPythonPlugin, and keep this folder open during the following steps.
  3. In Glyphs, go to Window > Plugin Manager > Modules, remove and reinstall the Python module.
  4. Wait a little bit (should not take longer than a minute) and watch the GlyphsPythonPlugin folder from step 2. If nothing happens, repeat step 3.
  5. When you see the following contents in your GlyphsPythonPlugin folder, you can restart the app: build.py, dist (folder), GlyphsPythonModul.py, Python.framework (folder), setup.py. It will look something like this:

folders

  1. Now go to Glyphs > Preferences > Addons, and choose the Python version that has the word ‘Glyphs’ in parentheses.

There’s the real scenario where users want to install multiple plugins/modules before restarting once. If you need to install 10+ items, forcing a restart every time will be more of a pain. And Glyphs does prompt users to restart.

Doesn’t seem to be a realistic scenario that someone wants to update 10 add-ons at the same time, though.