psychopy.org | Reference | Downloads | Github

TextBox broken?

TextBox appears to be broken in 1.86.6

python textstim_vs_textbox.py
Traceback (most recent call last):
File “textstim_vs_textbox.py”, line 25, in
from psychopy.visual import textbox
File “/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/visual/textbox/init.py”, line 59, in
fm = getFontManager()
File “/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/visual/textbox/init.py”, line 56, in getFontManager
_system_font_manager = FontManager(mono_only)
File “/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/visual/textbox/fontmanager.py”, line 77, in init
self.updateFontInfo(monospace_only)
File “/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/visual/textbox/fontmanager.py”, line 244, in updateFontInfo
self.addFontFiles(fonts_found, monospace_only)
File “/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/visual/textbox/fontmanager.py”, line 151, in addFontFiles
face = Face(fp)
File “/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/visual/textbox/freetype_bf/init.py”, line 1074, in init
if error: raise FT_Exception( error )
psychopy.visual.textbox.freetype_bf.ft_errors.FT_Exception: FT_Exception: (broken file)
glupyan ~/anaconda2/lib/python2.7/site-packages/psychopy/demos/coder/stimuli/textBoxStim $

That’s weird - it’s working fine for me under 1.90.1 standalone with both Py2.7 and Py3.6 (under MacOS).

My guess is some incompatibility with the anaconda installed python (maybe incompatible freetype lib?)

Here’s a minimal example showing the problem. This is with psychopy 1.90.1

>>> from psychopy import core, visual
>>> visual.TextBox()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/contrib/lazy_import.py", line 119, in __call__
    obj = object.__getattribute__(self, '_resolve')()
  File "/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/contrib/lazy_import.py", line 88, in _resolve
    obj = factory(self, scope, name)
  File "/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/contrib/lazy_import.py", line 203, in _import
    module = __import__(module_python_path, scope, scope, [member], level=0)
  File "/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/visual/textbox/__init__.py", line 59, in <module>
    fm = getFontManager()
  File "/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/visual/textbox/__init__.py", line 56, in getFontManager
    _system_font_manager = FontManager(mono_only)
  File "/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/visual/textbox/fontmanager.py", line 77, in __init__
    self.updateFontInfo(monospace_only)
  File "/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/visual/textbox/fontmanager.py", line 244, in updateFontInfo
    self.addFontFiles(fonts_found, monospace_only)
  File "/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/visual/textbox/fontmanager.py", line 151, in addFontFiles
    face = Face(fp)
  File "/Users/glupyan/anaconda2/lib/python2.7/site-packages/psychopy/visual/textbox/freetype_bf/__init__.py", line 1074, in __init__
    if error: raise FT_Exception( error )
psychopy.visual.textbox.freetype_bf.ft_errors.FT_Exception: FT_Exception:  (broken file)

importing freetype works fine. Do you know how I can check if the freetype libraries are the right ones?