GSPen and objectsGS Error: ImportError: cannot import name 'GSQCURVE' from 'objectsGS'

Hi, I’m trying to write a script and the code below caused an ImportError.
Could someone help me to solve the issue?

Code:

source = CurrentGlyph()
source.getPen()

Error:

Traceback (most recent call last):
  File "<macro panel>", line 2
  File "objectsBase.py", line 1453, in getPen
    return SegmentToPointPen(self.getPointPen())
  File "GlyphsApp/objectsGS.py", line 660, in getPointPen
  File "GlyphsApp/GSPen.py", line 10
ImportError: cannot import name 'GSQCURVE' from 'objectsGS' (/Applications/Glyphs 3.app/Contents/Scripts39/objectsGS.pyc)

My environment:

  • macOS Big Sur 11.2.3
  • Glyphs 3.0.3 (3081)
  • Python 3.9.4 (Homebrew)
    • Installed FontTools, Python, RoboFab, and Vanilla from the Plugin Manager
    • Installed PyObjC and FontTools with pip

Thanks in advance.

I omit the following part in the source code which was apparently where the problem is.

from robofab.world import CurrentGlyph

source = CurrentGlyph()
source.getPen()

This should reproduce the error.

However, I was able to get what I want from:

for layer in Font.selectedLayers:
  layer.getPen()

Now it works perfect, thanks!

1 Like

Yes, for some pen methods, you do not need RoboFab anymore.

Is this the RoboFab module you instaled through Plugin Manager, or do you have a custom installation?

1 Like

I fixed the missing import. Thanks.

1 Like