I’ll write something.
Thanks Georg, very much appreciated!
@FontMaster Hi Frank, problem was with Vanilla and Robofab libraries. Go to preference>addons>modules and install libraries. In my case something was wrong with my system and even though those libraries were installed program couldn’t read them, so @GeorgSeifert wrote a line of code and told me to paste it to one of the folders — this helped and program started to read libraries.
Installing python modules:
There are some python modules that are needed by some script.
- vanilla: A library to build user interfaces like windows and dialogs. https://github.com/typesupply/vanilla
- robofab: An API to interact with font data. It was used in FontLab and is the default data model in RoboFont. Glyphs supports it to allow scripts to run in RoboFont and Glyphs. https://github.com/robofab-developers/robofab
- fontTools: fontTools is a library for manipulating binary tables in OpenType fonts https://github.com/fonttools/fonttools
Automatic installation
In Glyphs goto Preferences > Addons > Modules > Install Modules
This will copy the libraries into /Library/Python/2.7/site-packages
. It will ask for your username and password.
Testing
Open the Macro panel in Glyphs and put run the following code:
import vanilla
print "vanilla", vanilla
import robofab
print "robofab", robofab
import fontTools
print "fontTools", fontTools
That should give this output:
vanilla <module 'vanilla' from '/Library/Python/2.7/site-packages/vanilla/__init__.pyc'>
robofab <module 'robofab' from '/Library/Python/2.7/site-packages/robofab/__init__.pyc'>
fontTools <module 'fontTools' from '/Library/Python/2.7/site-packages/fontTools/__init__.pyc'>
When you get an error
First, check if the libraries are actually in the site-packages folder (/Library/Python/2.7/site-packages)
Then, run this in the Macro window.
import sys
print "\n".join(sys.path)
That should give a long list of paths (I got 23 entries, but around 10 should be OK for a fresh system). Some important:
/Users/georg/Library/Application Support/Glyphs/Scripts
/Library/Python/2.7/site-packages
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC
If any of the above are missing, there is something wrong with your python environment.
How to fix
After every step you do, restart Glyphs and run the import/print
script
If the libraries are in the site-packages folder and /Library/Python/2.7/site-packages
is in sys.path, then check the file easy-install.pth
. What to look for is difficult to says without seeing it ;(
A quick and dirty solution would be to copy the libraries info the Glyphs Script folder (~/Library/Application Support/Glyphs/Scripts).
If the libraries are nowhere to be found, download them from the links shown above. In each folder is a Lib
with another folder with the name of the library. Copy that folder into site-packages
or the Glyphs Scripts
folder.
I hope this helps. Any suggestions are welcome.
Hi Edward, thank you for your reply. Installing the libraries looked in the few cases that I saw the most obvious thing to do, if only because this is well described in the online documentation of Glyphs. However, the message stating that the Vanilla, RoboFab, and FontTools modules were missing (IIRC in the Python 2.7 folder) popped up recurrently. So, you are probably not the only one who encountered this specific problem.
Thanks Georg for the swift and detailed support!
I’m having the BadPrototypeError
problem too. Using latest Glyphs (1075). It’s not about the plugins. I removed all my plugins and typed into the Macro window:
from GlyphsApp.plugins import *
Got this error:
Traceback (most recent call last):
File "<string>", line 6, in <module>
File "GlyphsApp/__init__.py", line 978, in <module>
objc.BadPrototypeError: Objective-C expects 1 arguments, Python argument has 2 arguments for <unbound selector callback of callbackHelperClass at 0x11e5ae1d0>
It might be about the Python version; more to the point, it might be about the pyobjc bridge version. /usr/bin/python
is 2.7.10 and sys.path
is
['/Library/Frameworks/SQLite3.framework/Versions/C/Python/2.7', '/Library/Frameworks/GEOS.framework/Versions/3/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/numpy-override', '/Library/Python/2.7/site-packages/matplotlib-override', '/Library/Frameworks/GDAL.framework/Versions/2.1/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/fontmake-1.0-py2.7.egg', '/Library/Python/2.7/site-packages/fonttools-3.9.2.dev0-py2.7.egg', '/Library/Python/2.7/site-packages/vanilla-0.1-py2.7.egg', '/Library/Python/2.7/site-packages/PyBluez-0.22-py2.7.egg', '/Library/Python/2.7/site-packages/pyobjc_framework_Cocoa-4.0b1-py2.7-macosx-10.12-intel.egg', '/Library/Python/2.7/site-packages/pyobjc_core-4.0b1-py2.7-macosx-10.12-intel.egg', '/Library/Python/2.7/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Users/simon/Library/Python/2.7/lib/python/site-packages', '/Library/Python/2.7/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages/FontTools', '/Users/simon/Library/Application Support/Glyphs/Scripts', '/Library/Application Support/Glyphs/Scripts', '/Network/Library/Application Support/Glyphs/Scripts', '/Applications/Glyphs.app/Contents/Scripts']
Edit: Nope, I uninstalled the pyobjc
egg I installed - it’s not about that. I also tried Adam’s suggestion here - not that either.
Edit 2: But it was something in /Library/Python/2.7/site-packages
. When I emptied that directory everything worked again.
That is fixed in the latest cutting edge version (that is about to be released)