Hi all,
I’m working on my first experiment with Psychopy 3, and I keep getting an error when I try to start an instance of visual.TextStim
. I’m running the standalone Psychopy v3.1.5 on Ubuntu 18.04.3 LTS. Here’s a minimal example that reproduces the error on my machine:
from psychopy import visual, core, data, event, monitors
win = visual.Window((500, 500),
fullscr=False,
color=(0, 0, 0),
colorSpace='rgb',
allowGUI=False)
text_stim = visual.TextStim(win, pos=(0, 0), text='hello')
text_stim.draw()
win.flip()
core.wait(4)
win.close()
And here’s the full traceback in case it’s helpful:
Traceback (most recent call last):
File "/home/local/ADF/brookshg/anaconda3/lib/python3.7/site-packages/pyglet/text/runlist.py", line 408, in ranges
starts[i], ends[i], values[i] = next(iterator)
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/local/ADF/brookshg/Documents/projects/saccades-attention/tests/textstim/textstim_test.py", line 13, in <module>
text_stim = visual.TextStim(win, pos=(0, 0), text='hello')
File "/home/local/ADF/brookshg/anaconda3/lib/python3.7/site-packages/PsychoPy-3.1.5-py3.7.egg/psychopy/visual/text.py", line 209, in __init__
self.setText(text, log=False)
File "/home/local/ADF/brookshg/anaconda3/lib/python3.7/site-packages/PsychoPy-3.1.5-py3.7.egg/psychopy/visual/text.py", line 354, in setText
setAttribute(self, 'text', text, log)
File "/home/local/ADF/brookshg/anaconda3/lib/python3.7/site-packages/PsychoPy-3.1.5-py3.7.egg/psychopy/tools/attributetools.py", line 141, in setAttribute
setattr(self, attrib, value)
File "/home/local/ADF/brookshg/anaconda3/lib/python3.7/site-packages/PsychoPy-3.1.5-py3.7.egg/psychopy/tools/attributetools.py", line 32, in __set__
newValue = self.func(obj, value)
File "/home/local/ADF/brookshg/anaconda3/lib/python3.7/site-packages/PsychoPy-3.1.5-py3.7.egg/psychopy/visual/text.py", line 345, in text
self._setTextShaders(text)
File "/home/local/ADF/brookshg/anaconda3/lib/python3.7/site-packages/PsychoPy-3.1.5-py3.7.egg/psychopy/visual/text.py", line 364, in _setTextShaders
width=self._wrapWidthPix) # width of the frame
File "/home/local/ADF/brookshg/anaconda3/lib/python3.7/site-packages/pyglet/font/text.py", line 338, in __init__
group=self._group)
File "/home/local/ADF/brookshg/anaconda3/lib/python3.7/site-packages/pyglet/text/layout.py", line 810, in __init__
self.document = document
File "/home/local/ADF/brookshg/anaconda3/lib/python3.7/site-packages/pyglet/text/layout.py", line 919, in _set_document
self._init_document()
File "/home/local/ADF/brookshg/anaconda3/lib/python3.7/site-packages/pyglet/text/layout.py", line 1020, in _init_document
self._update()
File "/home/local/ADF/brookshg/anaconda3/lib/python3.7/site-packages/pyglet/text/layout.py", line 956, in _update
lines = self._get_lines()
File "/home/local/ADF/brookshg/anaconda3/lib/python3.7/site-packages/pyglet/text/layout.py", line 932, in _get_lines
glyphs = self._get_glyphs()
File "/home/local/ADF/brookshg/anaconda3/lib/python3.7/site-packages/pyglet/text/layout.py", line 1055, in _get_glyphs
for start, end, (font, element) in runs.ranges(0, len(text)):
RuntimeError: generator raised StopIteration
Thanks in advance for any suggestions!
geoff