Rectangle causes experiment to crash - AttributeError: ‘VertexDomain’ object has no attribute ‘attributes'

OS (e.g. Win10): Win10 and MacOS14
PsychoPy version (e.g. 1.84.x): 2023.2.2
Standard Standalone? (y/n) y
What are you trying to achieve?:
I have a rectangular polygon that needs to be constantly visible on screen. My text stimuli change every 1/6th of a second so I have created a loop containing the text stimulus and the rectangle, both with a duration of 1/6 seconds. In 2022.2.4, this worked OK, but since we’ve upgraded to 2023.2.2, the experiment crashes with the following error:
AttributeError: ‘VertexDomain’ object has no attribute ‘attributes’

The experiment should show 3600 stimuli, I’ve checked the data files and it has crashed after 957, 3173, and 3443 stimuli in the last three attempts.

What did you try to make it work?:
I tried upgrading to version 2023.2.3 but it still happened.
I tried disabling the polygon and creating a new one. It did not crash when the new polygon was added as a triangle but when I changed it to a rectangle it crashed again.

What specifically went wrong when you tried that?:
I get a very long and complicated error message:
warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}"
Traceback (most recent call last):
30
[101, 149, 18, 53, 40]
150
[5]
30
[62, 116, 98, 9, 79]
150
[28]
30
[80, 85, 1, 65, 90]
150
[11]
30
[126, 5, 89, 142, 64]
150
11.9984 WARNING t of last frame was 25.31ms (=1/39)
File “C:\Program Files\PsychoPy\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\student\Box\Uni\Projects\NewerStill_lastrun.py”, line 2006, in
run(
File “C:\Users\student\Box\Uni\Projects\NewerStill_lastrun.py”, line 1507, in run
DistTxt2.setOpacity((0.5sin((12pit)-(0.5pi)))+0.5, log=False)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\basevisual.py”, line 1936, in setOpacity
self.updateOpacity()
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\text.py”, line 684, in updateOpacity
self._setTextShaders(value=self.text)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\text.py”, line 399, in setTextShaders
self.pygletTextObj = pyglet.text.Label(
File "C:\Program Files\PsychoPy\lib\site-packages\pyglet\text_init
.py", line 452, in init
super(Label, self).init(document, x, y, width, height,
File "C:\Program Files\PsychoPy\lib\site-packages\pyglet\text_init
.py", line 273, in init
super(DocumentLabel, self).init(document,
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\text\layout.py”, line 820, in init
self.document = document
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\text\layout.py”, line 929, in _set_document
self._init_document()
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\text\layout.py”, line 1043, in _init_document
self._update()
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\text\layout.py”, line 980, in _update
self._create_vertex_lists(left + line.x, top + line.y,
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\text\layout.py”, line 1476, in create_vertex_lists
box.place(self, i, x, y, context)
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\text\layout.py”, line 370, in place
vertex_list = layout.batch.add(n_glyphs * 4, GL_QUADS, group,
File "C:\Program Files\PsychoPy\lib\site-packages\pyglet\graphics_init
.py", line 368, in add
domain = self.get_domain(False, mode, group, formats)
File "C:\Program Files\PsychoPy\lib\site-packages\pyglet\graphics_init
.py", line 458, in _get_domain
domain = vertexdomain.create_domain(*formats)
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\graphics\vertexdomain.py”, line 140, in create_domain
return VertexDomain(attribute_usages)
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\graphics\vertexdomain.py”, line 189, in init
attribute.buffer = vertexbuffer.create_mappable_buffer(
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\graphics\vertexbuffer.py”, line 115, in create_mappable_buffer
return MappableVertexBufferObject(size, target, usage)
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\graphics\vertexbuffer.py”, line 389, in init
super(MappableVertexBufferObject, self).init(size, target, usage)
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\graphics\vertexbuffer.py”, line 308, in init
glBufferData(target, self.size, None, self.usage)
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\gl\lib.py”, line 106, in errcheck
raise GLException(msg)
pyglet.gl.lib.GLException: b’out of memory’
Exception ignored in: <function VertexDomain.del at 0x000001E5BEC83F70>
12.0294 WARNING t of last frame was 31.01ms (=1/32)
12.0623 WARNING t of last frame was 20.27ms (=1/49)
12.1110 WARNING t of last frame was 20.40ms (=1/49)
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\graphics\vertexdomain.py”, line 238, in del
for attribute in self.attributes:
AttributeError: ‘VertexDomain’ object has no attribute ‘attributes’
################ Experiment ended with exit code 1 [pid:14048] #################
3390.8725 INFO Loaded monitor calibration from [‘2023_08_10 12:14’]

My advice is to continue using version 2022.2.4 which I suppose is also the version in which the task has been built. Even if you’ve upgraded to version 2023.2.2, you can set the version in which you want the task to run. Go in “Settings” - “Use version Psychopy” and choose the version 2022.2.4 from the drop-down menu. Imposing the version in which the task worked, it shouldn’t give you this error.

That’s helpful. Thank you.