らんだむな記憶

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

Glyphsとnumpy(2)

Glyphsとnumpy - らんだむな記憶とは言うもののめげていても仕方ない。パスの検索順序ということは... sys.path 内の順序か?🤔と思ったので、やったことないけど sys.path.remove を使うことにした。消しっぱは怖いので、末尾に突っ込んではあげる。つまり再度 sys.path.append してあげる。

import sys
low_priority_path = "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python"
sys.path.remove(low_priority_path)
sys.path.append(low_priority_path)
import bezier
print bezier.__file__
/Users/xxx/Library/Application Support/Glyphs/Scripts/bezier/__init__.pyc

きたー!!!

なお、bezierが依存していたのはnumpy以外にenumsix.pyもあったので、これも「~/Library/Application Support/Glyphs/Scripts」以下に置いてあげないとダメだった。