textbox demos borked ? fontmanager issues

117 views
Skip to first unread message

Rob Stone

unread,
Jun 27, 2014, 7:33:15 AM6/27/14
to psychop...@googlegroups.com

Hi,

clean install of standalone Psychopy on my mac (full details below). Some of the demos don't work :-(
is this known, my set up or legacy issues, something  else

 cheers


1.1658 WARNING Creating new monitor...
1.1660 WARNING Creating new monitor...
Traceback (most recent call last):
  File "/Users/rob/Desktop/coding/exp-gen/psychopy/PsychoPy2-1.803.app/Contents/Resources/lib/python2.7/psychopy/visual/textbox/fontmanager.py", line 146, in addFontFiles
    face=Face(fp)
  File "/Users/rob/Desktop/coding/exp-gen/psychopy/PsychoPy2-1.803.app/Contents/Resources/lib/python2.7/psychopy/visual/textbox/freetype_bf/__init__.py", line 1059, in __init__
    if error: raise FT_Exception( error )
FT_Exception: FT_Exception:  (unknown file format)
Traceback (most recent call last):
  File "/Users/rob/Desktop/coding/exp-gen/psychopy/PsychoPy2-1.803.app/Contents/Resources/lib/python2.7/psychopy/demos/coder/stimuli/textBoxStim/textbox_simple.py", line 28, in <module>
    units='norm',
  File "/Users/rob/Desktop/coding/exp-gen/psychopy/PsychoPy2-1.803.app/Contents/Resources/lib/python2.7/psychopy/visual/textbox/__init__.py", line 359, in __init__
    self._font_name=fm.getFontFamilyStyles()[0][0]
IndexError: list index out of range
##### Running: /Users/rob/Desktop/coding/exp-gen/psychopy/PsychoPy2-1.803.app/Contents/Resources/lib/python2.7/psychopy/demos/coder/sysInfo.py #####
Paths to files on the system:
    userPrefsFile: /Users/rob/.psychopy2/userPrefs.cfg
    appDataFile: /Users/rob/.psychopy2/appData.cfg
    demos: /Users/rob/Desktop/coding/exp-gen/psychopy/PsychoPy2-1.803.app/Contents/Resources/lib/python2.7/psychopy/demos
    appFile: /Users/rob/Desktop/coding/exp-gen/psychopy/PsychoPy2-1.803.app/Contents/Resources/lib/python2.7/psychopy/app/PsychoPy.py




System info:
Darwin-13.2.0-x86_64-i386-32bit
OS X 10.9.3 running on x86_64

Python info
/Users/rob/Desktop/coding/exp-gen/psychopy/PsychoPy2-1.803.app/Contents/MacOS/python
2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:32:06) 
[GCC 4.0.1 (Apple Inc. build 5493)]
numpy 1.8.0
scipy 0.12.0
matplotlib 1.3.0
pyglet 1.1.4
pyo 0.6.6

PsychoPy 1.80.06
have shaders: True

OpenGL info:
vendor: ATI Technologies Inc.
rendering engine: ATI Radeon HD 4670 OpenGL Engine
OpenGL version: 2.1 ATI-8.24.13
(Selected) Extensions:
True GL_ARB_multitexture
True GL_EXT_framebuffer_object
True GL_ARB_fragment_program
True GL_ARB_shader_objects
True GL_ARB_vertex_shader
True GL_ARB_texture_non_power_of_two
True GL_ARB_texture_float
False GL_STEREO
max vertices in vertex array: 1048575
3.9949 WARNING Creating new monitor...
3.9950 WARNING Creating new monitor...

Jonathan Peirce

unread,
Jun 27, 2014, 11:07:44 AM6/27/14
to psychop...@googlegroups.com
Hi Rob,

Hopefully it's just the ones related to the TextBox stimulus? This has a couple of extra dependencies that I haven't ironed out on the standalone installations yet. You can still create text using the standard text stimulus though. Were there others that don't work?

cheers,
Jon
--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/1d129d7b-8e3e-4293-933a-48df77fd72e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Jonathan Peirce
Nottingham Visual Neuroscience

http://www.peirce.org.uk

Sol Simpson

unread,
Jun 28, 2014, 11:00:02 AM6/28/14
to psychop...@googlegroups.com
Hi Rob,

I do not think this is a missing freetype library issue; last I checked that was working fine.

The issue you are reporting is fixed in the psychopy/psychopy master branch. Basically, on OSX, there is a .TTF file that is not actually TTF font file, but a text file listing the available font files. ;)  

To check if the source you have has the fix or not,  open the psychopy/visual/textbox/fontmanager.py file in your site-packages, and check that lines 145 - 153 are as follows:

                try:
                    face = Face(fp)
                    if monospace_only:
                        if face.is_fixed_width:
                            fi_list.append(self._createFontInfo(fp,face))
                    else:
                        fi_list.append(self._createFontInfo(fp,face))
                except FT_Exception, fte:
                    pass

If not, please try getting the textbox folder from psychopy/psychopy master and (after a backup up) replacing the folder that you have from the install with it. Does that fix the issue?

** Also note that the textbox demo's are broken on psychopy/psychopy master after all the visual demo's were changed from using .getX to .x for visual attributes. Textbox has not been updated to use properties, so the change needs to be reverted for these demo's. 

This is easy to do, in the textbox demo's where there is something like 

textbox.text = newtext

change that back to 

.setText(newtext)
 
and the text demo's will run fine again. 

I can not fix these issues and submit a pull request myself because my fork of psychopy has a lot of other changes that are not completed and I can not do a pull request on a specific file in my fork, only the whole fork it seems.

Sorry about all this.

Sol

Sol Simpson

unread,
Jun 28, 2014, 11:07:16 AM6/28/14
to psychop...@googlegroups.com
More specifically about the demo lines that need to be reverted before they will run:

In demo /stimuli/textBoxStim/textbox_glyph_placement.pyline 81 need to be changed back to:

mouse_position.setText("%.3f,%.3f"%(mp[0],mp[1]))

In demo stimuli/textBoxStim/textstim_vs_textbox.py, line 68 needs to be reverted to:

        stim.setText(text)

Thanks again,

Sol

Rob Stone

unread,
Jun 30, 2014, 5:19:09 AM6/30/14
to psychop...@googlegroups.com
Hi Jon, Sol

yes everything else seems to be ok (i just wanted to show some students some cool stuff :-)

I'll look into those lines/files Sol and report back 



Rob Stone

unread,
Jun 30, 2014, 5:37:39 AM6/30/14
to psychop...@googlegroups.com

some more info  lines 145....  in fontmanager.py

 
                  try:
                    face=Face(fp)
                    if monospace_only:
                        if face.is_fixed_width:
                            fi_list.append(self._createFontInfo(fp,face))
                    else:
                        fi_list.append(self._createFontInfo(fp,face))
                except Exception, e:
                    import traceback
                    traceback.print_exc()
                    return None
                    pass
 
will try and find the master and install etc  and report back

Rob Stone

unread,
Jun 30, 2014, 10:42:44 AM6/30/14
to psychop...@googlegroups.com


so i eventually figured out how to get a copy of the master and installed the new textbox folder into visual and it all works fine :-)

interestingly (or not as i've no idea how this is all configured) inside my resources i have 3 copiers of visual (and other stuff!)

Users/rob/Desktop/coding/exp-gen/psychopy/PsychoPy2-1.803.app/Contents/Resources/lib/python2.7/

psycopy/, psychopy-1.80.03/,  and  psychopy-1.80.05/

as it has autoupdated. It uses the psycopy folder (i presume this is correct just a bit funky)

Cheers

Jonathan Peirce

unread,
Jun 30, 2014, 11:13:59 AM6/30/14
to psychop...@googlegroups.com

On 30/06/2014 15:42, Rob Stone wrote:
>
> as it has autoupdated. It uses the psycopy folder (i presume this is
> correct just a bit funky)
Yes, exactly. It isn't pretty, but it works ;-)

Sol Simpson

unread,
Jun 30, 2014, 4:16:05 PM6/30/14
to psychop...@googlegroups.com
Great; thanks for letting us know.
Reply all
Reply to author
Forward
0 new messages