Unichr() arg not in range

I’ve written a basic script that prints the glyph string for glyphs in the font. However, in the particular font I’m working on, there are some glyphs in extremely high glyph ranges (uni2000B for example) and am encountering an error:

Traceback (most recent call last):
  File "<macro>", line 2, in <module>
  File "GlyphsApp/GlyphsApp/__init__.py", line 4995, in <lambda>
  File "GlyphsApp/GlyphsApp/__init__.py", line 4993, in _get_Glyphs_String
ValueError: unichr() arg not in range(0x10000) (narrow Python build)

Is this a limitation of the Python implementation in the Macro panel? It seems that Glyphs can access the glyph, and display info—just that the string doesn’t want to display.

1 Like

I’ll fix this. Until then, please use this:

glyph.charString()

This is a native objectiveC method that works fine with the upper plane chars.
(and I would suggest to use u2000B)

Thanks Georg!

I found a few more places that use unichr(). Thanks.

1 Like