Scripts not working "Glyphs is not defined"

I just formatted my computer and scripts are not working on my new setup.

If I run print(Glyphs) on the macro panel I get:

Traceback (most recent call last):
  File "<internal>", line 4
  File "GlyphsApp/GlyphsApp/__init__.py", line 642
AttributeError: Cannot replace selector 'font' in 'GSApplication' by non-selector
Traceback (most recent call last):
  File "<macro panel>", line 1
NameError: name 'Glyphs' is not defined

I’m on Big Sur using Python 3.9.13 from Homebrew.

Any help?

Changed to Python from Package manager and works.

If you have python from homebrew, you also need to install pyobjc (pip3 install pyobjc).

It is installed and it doesn’t work but don’t worry too much I can use Glyphs version. Thanks.

I just tried to update Glyphs python to python 3.10 and ran into the same problem. It seem to be a problem with pyobjc 8.5. Downgrading to 8.4 works.

pip3 install pyobjc==8.4

(Problem overwriting objc methods in pyobjc 8.5 · Issue #479 · ronaldoussoren/pyobjc · GitHub)

What version of Glyphs do you have and how did you install python?

Hey!
I used the Plugins Adm, my Glyphs is the last version 3.

I have 3.10.5 and 3.9.2 in my computer, and install using the official pack downloaded from Python website.
I’m trying to use mekkablue script.

Install pyobjc with the command I mentioned above (with the version number). Then check in Preferences > Addons, what version glyphs is using.

I installed like your mention above and I teste with all of them:

And the same: the glyphs quit

What version of Glyphs do you have? Did you send crash reports? Please always send them when the dialog comes up (the one that comes up when you restart the app).

And can you remove all plugins from the plugins folder? You can re-install them from the plugin manager, later.

I’m using the last version of Glyphs 3.
Yes, I removed all twice these folders e re-install:
Repositories
Scripts
Temp
I think the problem is in my computer or pyobjc 8.4 . I don’t have another to test it.

Mac OS 10.12.6
python3 --version
Python 3.10.5

pip3 --version
pip 22.1.2 from /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip (python 3.10)

pip3 list
Package                                Version
-------------------------------------- -------
pip                                    22.1.2
pyobjc                                 8.4
pyobjc-core                            8.4
pyobjc-framework-Accounts              8.4
pyobjc-framework-AddressBook           8.4
pyobjc-framework-AppleScriptKit        8.4
pyobjc-framework-AppleScriptObjC       8.4
pyobjc-framework-ApplicationServices   8.4
pyobjc-framework-AudioVideoBridging    8.4
pyobjc-framework-Automator             8.4
pyobjc-framework-AVFoundation          8.4
pyobjc-framework-AVKit                 8.4
pyobjc-framework-CalendarStore         8.4
pyobjc-framework-CFNetwork             8.4
pyobjc-framework-CloudKit              8.4
pyobjc-framework-Cocoa                 8.4
pyobjc-framework-Collaboration         8.4
pyobjc-framework-Contacts              8.4
pyobjc-framework-ContactsUI            8.4
pyobjc-framework-CoreAudio             8.4
pyobjc-framework-CoreAudioKit          8.4
pyobjc-framework-CoreBluetooth         8.4
pyobjc-framework-CoreData              8.4
pyobjc-framework-CoreLocation          8.4
pyobjc-framework-CoreMedia             8.4
pyobjc-framework-CoreMediaIO           8.4
pyobjc-framework-CoreMIDI              8.4
pyobjc-framework-CoreServices          8.4
pyobjc-framework-CoreText              8.4
pyobjc-framework-CoreWLAN              8.4
pyobjc-framework-CryptoTokenKit        8.4
pyobjc-framework-DictionaryServices    8.4
pyobjc-framework-DiscRecording         8.4
pyobjc-framework-DiscRecordingUI       8.4
pyobjc-framework-DiskArbitration       8.4
pyobjc-framework-DVDPlayback           8.4
pyobjc-framework-EventKit              8.4
pyobjc-framework-ExceptionHandling     8.4
pyobjc-framework-FinderSync            8.4
pyobjc-framework-FSEvents              8.4
pyobjc-framework-GameCenter            8.4
pyobjc-framework-GameController        8.4
pyobjc-framework-GameKit               8.4
pyobjc-framework-GameplayKit           8.4
pyobjc-framework-ImageCaptureCore      8.4
pyobjc-framework-IMServicePlugIn       8.4
pyobjc-framework-InputMethodKit        8.4
pyobjc-framework-InstallerPlugins      8.4
pyobjc-framework-InstantMessage        8.4
pyobjc-framework-Intents               8.4
pyobjc-framework-IOSurface             8.4
pyobjc-framework-iTunesLibrary         8.4
pyobjc-framework-LatentSemanticMapping 8.4
pyobjc-framework-LaunchServices        8.4
pyobjc-framework-libdispatch           8.4
pyobjc-framework-LocalAuthentication   8.4
pyobjc-framework-MapKit                8.4
pyobjc-framework-MediaAccessibility    8.4
pyobjc-framework-MediaLibrary          8.4
pyobjc-framework-MediaPlayer           8.4
pyobjc-framework-MediaToolbox          8.4
pyobjc-framework-Metal                 8.4
pyobjc-framework-MetalKit              8.4
pyobjc-framework-ModelIO               8.4
pyobjc-framework-MultipeerConnectivity 8.4
pyobjc-framework-NetFS                 8.4
pyobjc-framework-NetworkExtension      8.4
pyobjc-framework-NotificationCenter    8.4
pyobjc-framework-OpenDirectory         8.4
pyobjc-framework-OSAKit                8.4
pyobjc-framework-Photos                8.4
pyobjc-framework-PhotosUI              8.4
pyobjc-framework-PreferencePanes       8.4
pyobjc-framework-PubSub                8.4
pyobjc-framework-Quartz                8.4
pyobjc-framework-SafariServices        8.4
pyobjc-framework-SceneKit              8.4
pyobjc-framework-ScreenSaver           8.4
pyobjc-framework-ScriptingBridge       8.4
pyobjc-framework-SearchKit             8.4
pyobjc-framework-Security              8.4
pyobjc-framework-SecurityFoundation    8.4
pyobjc-framework-SecurityInterface     8.4
pyobjc-framework-ServiceManagement     8.4
pyobjc-framework-Social                8.4
pyobjc-framework-SpriteKit             8.4
pyobjc-framework-StoreKit              8.4
pyobjc-framework-SyncServices          8.4
pyobjc-framework-SystemConfiguration   8.4
pyobjc-framework-VideoToolbox          8.4
pyobjc-framework-WebKit                8.4
setuptools                             58.1.0
wheel                                  0.37.1

Remove everything from those folders and only install the Glyphs Python. Restart Glyphs. Select the Glyphs python in Preferences > Addons. Restart Glyphs again. Then run a small script like this in the macro window:

print("Hallo")

I also have this problem: downloaded the trial of Glyphs today.

print(“hello”) works, but “Glyphs” is not defined.

MacOS Sonoma 14.2. python 3.10.

Follow the steps in the Extending Glyphs tutorial.

The issue is that you are using a python version that does not have the python objective-c bridge installed. Best to use the Python provided in Plugin Manager.

The python does have pyobjc. I use it for lots of stuff.
Commands like 'import Quartz` work fine.

Yes, the built-in python that isn’t installed by default does work. :grin:

Incidentally, Glyphs only listed the macOS bundled python 3.10; it didn’t list the installed python 3.11 from python.org. But both of them have pyobjc installed.

You can use the latest cutting edge version (activate it in Preferences > Update). It supports Python 3.11 and 3.12.