らんだむな記憶

blogというものを体験してみようか!的なー

Glyphsとnumpy

/System/Library/Frameworks/Python.framework/Versions/2.7/Extrasというものがある。
特に.../2.7/Extras/lib/python/numpyがある。そしてモジュールの検索パスとしては、site-packagesより強いようだ。
Which Python · MacPython/wiki Wiki · GitHub

ということはシステムのpythonを使う限りnumpyは古いものが参照される。
そして、Glyphsはどうやらシステムのpythonを使う。
さて、bezier 0.5.0 : Python Package IndexをGlyphsから使いたかったのだが、このモジュールはnumpyに依存している。

Glyphs doesn't see libraries - Glyphs - Glyphs Forum
bezierのインストール自体はわりと単純にできて、

If the installing of modules doesn't work there are two reasons. You might have installed a custom Python version. Or there is something wrong with the paths/sitepackages folder.

The easiest solution is to got to /Library/Python/2.7/site-packages copy the path, open Finder, press cmd+shift+G, paste the path).
in that folder, you should find a folder for fonttools, robofab and vanilla. Copy all three into ~/Library/Application Support/Glyphs/Scripts (in Glyphs, click Open Script Folder from the Script menu) and restart Glyphs.

という作者のコメントを真似る形で「~/Library/Application Support/Glyphs/Scripts」においてあげればimportが実行できるようになった。が、numpyがね...。

File "Cython/Includes/numpy/__init__.pxd", line 155, in init bezier._curve_speedup
ValueError: numpy.dtype has the wrong size, try recompiling. Expected 88, got 96

はぁ...。