Text component with variable crashes while running trial

Hello Psychopy community,
I am quite new to Psychopy and Python in general. Anyways, I started creating an experiment a while ago. So far, it worked perfectly and the comments in this forum helped me a lot to design it! Many thanks! :slight_smile:

OS: Win10
PsychoPy version (3.0.3):
Standard Standalone? (y)

What are you trying to achieve?:
I try to build a decode task in which participants have to decode a section of numbers into letters using their keyboard as feedback device. Such as:
‘Code’ = ‘Decode’
‘318’ = ‘A’
‘218’ = ‘B’

‘211’ = ‘Z’

What did you try to make it work?:
Thus, I have two parameters (Code, Decode) and 26 parameters (318, 218,…,211; A, B,…,Z).
The codes are shown randomly in a text component by using “$Code” (set every repeat). The trial is limited to 120s by an additional coundtown which forces the end of routine when it’s at 0s.

What specifically went wrong when you tried that?:
During the trial, Psychopy crashes randomly. Sometimes, it crashes after 30s, sometimes after more than 1 minute of the trail. As result, I receive the following report:

File "C:\Users\Fabian\Desktop\Python\PsychopyBuilder\DemoTask.py", line 662, in <module>
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\visual\text.py", line 808, in draw
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\pyglet\font\text.py", line 557, in draw
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\pyglet\text\layout.py", line 897, in draw
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\pyglet\graphics\__init__.py", line 560, in draw
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\pyglet\graphics\__init__.py", line 492, in <lambda>
    (lambda d, m: lambda: d.draw(m))(domain, mode))
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\pyglet\graphics\vertexdomain.py", line 316, in draw
    glDrawArrays(mode, starts[0], sizes[0])
OSError: exception: access violation reading 0x00000010

I really do not know how to interpret this report. Somewhere else, not in this forum, I read that it might be possible the text compenent with “$Code” causes the problem (but could not find the website anymore). Users recommened to use a TextBox instead. But, I do not have any clue how to use the TextBox with random output (in my case the “Code” column of the excel file in the trial). Probably, my problem can be solved by using the text component which I already use.


Could you provide a minimal working example? You could set up an experiment with just one routine which does what you described above. Then, you could assemble the code and post the code here. This should make it easier to find the error.

Hi Lukas,
Unfortunately, I have changed a bit of the coding components in my study. At this time, I could not replicate the error anymore. Thanks, so far. :slight_smile:
I’ll let you have if the error occurs again.


1 Like