psychopy.org | Reference | Downloads | Github

PsychoPy 1.84.1 crashes in previously-running script

Hi all,

I have a script to run an experiment that presents stimuli and records answers. The script was running normally in the previous version of PsychoPy (1.83), but since upgrading to 1.84.1, the script crashes right after the instructions screen (where the block type is selected and the first trial is presented), with the follwing error:

###### Running: D:\Experiments\Imagery\Tasks\2.MRI\imageryMRI_lastrun.py #######
pyo version 0.8.0 (uses single precision)
FreeType import Failed: Freetype library not found
Traceback (most recent call last):
  File "D:\Experiments\Imagery\Tasks\2.MRI\imageryMRI_lastrun.py", line 648, in <module>
    units='norm')
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.1-py2.7.egg\psychopy\contrib\lazy_import.py", line 120, in __call__
    return obj(*args, **kwargs)
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.1-py2.7.egg\psychopy\visual\textbox\__init__.py", line 376, in __init__
    self._font_name = fm.getFontFamilyStyles()[0][0]
IndexError: list index out of range

Sometimes the script crashes right after running it (pressing Ctrl+R), whereas other times it gets to the initial (instructions) screen and only crashes after the spacebar is pressed there to continue.

Googling the terms above did not find me anything helpful. I checked all routines&components again and can find nothing that would be problematic.

I uploaded my script here in case anyone is able to have a look. Many thanks for any help.

OS (e.g. Win10): Win 8
PsychoPy version (e.g. 1.84.x): 1.84.1
Standard Standalone? (y/n) If not then what?: y
**What are you trying to achieve?:run my script

I’m getting similar errors when running any of the textbox demos with PsychoPy 1.85.1. I did a bit of digging to try and figure out why, but it’s beyond me. Obviously it’s not finding the freetype library but I’m not sure why.

##### Running: C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\demos\coder\stimuli\textBoxStim\textstim_vs_textbox.py #####
FreeType import Failed: Freetype library not found
Traceback (most recent call last):
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\demos\coder\stimuli\textBoxStim\textstim_vs_textbox.py", line 98, in <module>
    font_name=available_font_names[0][0]
IndexError: list index out of range
1.8857 	WARNING 	TextBox Font Manager Found No Fonts.
##### Running: C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\demos\coder\stimuli\textBoxStim\textbox_simple.py #####
FreeType import Failed: Freetype library not found
Traceback (most recent call last):
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\demos\coder\stimuli\textBoxStim\textbox_simple.py", line 28, in <module>
    units='norm',
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\contrib\lazy_import.py", line 120, in __call__
    return obj(*args, **kwargs)
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\visual\textbox\__init__.py", line 376, in __init__
    self._font_name = fm.getFontFamilyStyles()[0][0]
IndexError: list index out of range
2.6160 	WARNING 	TextBox Font Manager Found No Fonts.
##### Running: C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\demos\coder\stimuli\textBoxStim\textbox_glyph_placement.py #####
FreeType import Failed: Freetype library not found
0.8465 	WARNING 	Monitor specification not found. Creating a temporary one...
2.0977 	WARNING 	TextBox Font Manager Found No Fonts.
Traceback (most recent call last):
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\demos\coder\stimuli\textBoxStim\textbox_glyph_placement.py", line 43, in <module>
    grid_vert_justification='center',
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\contrib\lazy_import.py", line 120, in __call__
    return obj(*args, **kwargs)
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\visual\textbox\__init__.py", line 376, in __init__
    self._font_name = fm.getFontFamilyStyles()[0][0]
IndexError: list index out of range

Apologies for the delay in looking into this. It looks like some upgrade caused the FreeType library to be replaced with one carrying a version number.

I’ve just released a new version (1.85.2) with this issue fixed, btu you could also fix it yourself by renaming a file:

C:/Program Files/PsychoPy2/DLLs/freetype6.dll

should be:

C:/Program Files/PsychoPy2/DLLs/freetype.dll

I think renaming that file is all you need to do for the lib to be found and the problem to be fixed! :slight_smile: