I think I am having an issue with TextStim (see error message below) and I would appreciate any insights on how to solve it.
Obs: The experiment runs fine most times, but I get this error in 1 out of 6 runs approx. The experiment breaks towards the end of it, around trial 34 to 39. I think it is a memory issue caused not by the videos but by TextStim but I don’t know exactly.
Experiment Descrtiption: The experiment consist of 40 short videos. After each video participants answer a multiple choice question. The response options are displayed as four TextStim in four rows. When participants hover the mouse over a response, their color is set to green to indicate current selection. I only have four TextStim objects and I set the text on each trial, so is not that I am creating hundreds of TextStims along the experiment. I also have one MovieStim object and I load each video to it each trial.
The error always happens after playing a video, when the text should be displayed:
Psychopy version used: 2024.2.1, run from a virtual environment
Traceback (most recent call last):
File “C:\venvs\psy2024\lib\site-packages\pyglet\graphics_init_.py”, line 452, in _get_domain
domain = domain_map[key]
KeyError: ((‘v2f/dynamic’, ‘t3f/dynamic’, ‘c4B/dynamic’), 7, False)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Users\Externdator\Documents\THESES_EXPERIMENTS\masc_leen_anastasija\main.py”, line 12, in
e.run_exp()
File “C:\Users\Externdator\Documents\THESES_EXPERIMENTS\masc_leen_anastasija\masc_exp.py”, line 700, in run_exp
self._run_trials(video_list, clips_path)
File “C:\Users\Externdator\Documents\THESES_EXPERIMENTS\masc_leen_anastasija\masc_exp.py”, line 530, in _run_trials
self._show_questions(video_idx + 1)
File “C:\Users\Externdator\Documents\THESES_EXPERIMENTS\masc_leen_anastasija\masc_exp.py”, line 382, in _show_questions
idx_response, click_time, click_coords = self._option_selection()
File “C:\Users\Externdator\Documents\THESES_EXPERIMENTS\masc_leen_anastasija\masc_exp.py”, line 440, in _option_selection
self._draw_response_options()
File “C:\Users\Externdator\Documents\THESES_EXPERIMENTS\masc_leen_anastasija\masc_exp.py”, line 331, in _draw_response_options
self.c.draw()
File “C:\venvs\psy2024\lib\site-packages\psychopy\visual\text.py”, line 736, in draw
self.setText()
File “C:\venvs\psy2024\lib\site-packages\psychopy\visual\text.py”, line 395, in setText
setAttribute(self, ‘text’, text, log)
File “C:\venvs\psy2024\lib\site-packages\psychopy\tools\attributetools.py”, line 140, in setAttribute
setattr(self, attrib, value)
File “C:\venvs\psy2024\lib\site-packages\psychopy\tools\attributetools.py”, line 29, in set
newValue = self.func(obj, value)
File “C:\venvs\psy2024\lib\site-packages\psychopy\visual\text.py”, line 386, in text
self._setTextShaders(text)
File “C:\venvs\psy2024\lib\site-packages\psychopy\visual\text.py”, line 404, in setTextShaders
self.pygletTextObj = pyglet.text.Label(
File "C:\venvs\psy2024\lib\site-packages\pyglet\text_init.py", line 452, in init
super(Label, self).init(document, x, y, width, height,
File "C:\venvs\psy2024\lib\site-packages\pyglet\text_init.py", line 273, in init
super(DocumentLabel, self).init(document,
File “C:\venvs\psy2024\lib\site-packages\pyglet\text\layout.py”, line 820, in init
self.document = document
File “C:\venvs\psy2024\lib\site-packages\pyglet\text\layout.py”, line 929, in _set_document
self._init_document()
File “C:\venvs\psy2024\lib\site-packages\pyglet\text\layout.py”, line 1043, in _init_document
self._update()
File “C:\venvs\psy2024\lib\site-packages\pyglet\text\layout.py”, line 980, in _update
self._create_vertex_lists(left + line.x, top + line.y,
File “C:\venvs\psy2024\lib\site-packages\pyglet\text\layout.py”, line 1476, in create_vertex_lists
box.place(self, i, x, y, context)
File “C:\venvs\psy2024\lib\site-packages\pyglet\text\layout.py”, line 370, in place
vertex_list = layout.batch.add(n_glyphs * 4, GL_QUADS, group,
File "C:\venvs\psy2024\lib\site-packages\pyglet\graphics_init.py", line 368, in add
domain = self.get_domain(False, mode, group, formats)
File "C:\venvs\psy2024\lib\site-packages\pyglet\graphics_init.py", line 458, in _get_domain
domain = vertexdomain.create_domain(*formats)
File “C:\venvs\psy2024\lib\site-packages\pyglet\graphics\vertexdomain.py”, line 140, in create_domain
return VertexDomain(attribute_usages)
File “C:\venvs\psy2024\lib\site-packages\pyglet\graphics\vertexdomain.py”, line 189, in init
attribute.buffer = vertexbuffer.create_mappable_buffer(
File “C:\venvs\psy2024\lib\site-packages\pyglet\graphics\vertexbuffer.py”, line 115, in create_mappable_buffer
return MappableVertexBufferObject(size, target, usage)
File “C:\venvs\psy2024\lib\site-packages\pyglet\graphics\vertexbuffer.py”, line 389, in init
super(MappableVertexBufferObject, self).init(size, target, usage)
File “C:\venvs\psy2024\lib\site-packages\pyglet\graphics\vertexbuffer.py”, line 308, in init
glBufferData(target, self.size, None, self.usage)
OSError: exception: access violation reading 0x0000000000000130
Thanks so much for your help!