WindowsError: exception: access violation writing 0x0000117E

Dear All

I programed many experiments on PsychoPy but it is the first time to face this problem with this experiment (the error message is below)

I had a look at other discussion so I want to let you know that I am creating one window at the beginning of the experiment and then I pass the window as parameter to some functions, however there are many stimuli drawing in the experiment as the experiment allows the user to enter a word in a text box and it shows a timer in the same window (I uses the text box as in the example written by Sol in the demos).
It looks like the memory getting full after a while of running the experiment, we have 12 computers in our lab and the the experiment crashed only on 2 of them (the computers are identical and they all have the same graphic card driver).
It will be very nice if someone could help.

Running: C:\Users\exp\Desktop\all\PsychoPy_Experimente\Words Finding\RunExp.py

Traceback (most recent call last):
File “C:\Users\exp\Desktop\all\PsychoPy_Experimente\Words Finding\RunExp.py”, line 659, in
main()
File “C:\Users\exp\Desktop\all\PsychoPy_Experimente\Words Finding\RunExp.py”, line 606, in main
result=enter_text(win,mymouse,word_list,con,tick_start,count) # return word with time_stamp [‘word’, ‘0:00:00’]
File “C:\Users\exp\Desktop\all\PsychoPy_Experimente\Words Finding\RunExp.py”, line 291, in enter_text
wrapWidth=win.size[0]*.9,color=(58,65,75),colorSpace=‘rgb255’)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\visual\text.py”, line 144, in init
self.setText(text, log=False) #self.width and self._fontHeightPix get set with text and calcSizeRendered is called
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\visual\text.py”, line 241, in setText
setAttribute(self, ‘text’, text, log)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\tools\attributetools.py”, line 100, in setAttribute
setattr(self, attrib, value) # set attribute, calling attributeSetter if it exists
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\tools\attributetools.py”, line 20, in set
newValue = self.func(obj, value)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\visual\text.py”, line 234, in text
self._setTextShaders(text)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\visual\text.py”, line 250, in _setTextShaders
width=self.wrapWidthPix)#width of the frame
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\font_init
.py", line 348, in init
group=self._group)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\text\layout.py”, line 791, in init
self.document = document
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\text\layout.py”, line 874, in _set_document
self._init_document()
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\text\layout.py”, line 977, in _init_document
self._update()
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\text\layout.py”, line 911, in _update
lines = self._get_lines()
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\text\layout.py”, line 887, in get_lines
glyphs = self.get_glyphs()
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\text\layout.py”, line 1016, in get_glyphs
glyphs.extend(font.get_glyphs(text[start:end]))
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\font\base.py”, line 378, in get_glyphs
self.glyphs[c] = glyph_renderer.render©
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\font\win32.py”, line 413, in render
glyph = self.font.create_glyph(image)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\font\base.py”, line 337, in create_glyph
glyph = texture.fit(image)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\font\base.py”, line 244, in fit
region.blit_into(image, 0, 0, 0)
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\image_init
.py", line 1766, in blit_into
self.owner.blit_into(source, x + self.x, y + self.y, z + self.z)
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\image_init
.py", line 1656, in blit_into
source.blit_to_texture(self.target, self.level, x, y, z)
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\pyglet\image_init
.py", line 969, in blit_to_texture
data)
WindowsError: exception: access violation writing 0x0000117E

The crash is being caused during update of standard text (NOT using Sol’s TextBox). This is probably caused by a known graphics card memory leak coming from pyglet. That has been fixed in the pyglet library that we’re now shipping with PsychoPy (the “1.2 maintenance” branch) but it still exists in the standard version of pyglet that gets installed by easy_install. So one workaround would be to replace that lib with a newer version.

The other option is to reduce the use of pyglet text in your experiment. In particular, make sure you aren’t using pyglet text to “update every frame”.

I suspect there is a slight difference in these 2 computers, like a different version of the graphics card driver that handles the memory error differently or a graphics card with more memory.

1 Like

Thank you very much Jon for your answer.

I am using a multiple visual.TextStim which is updated inside a loop at every iteration where the subject enters a text, also a history of the entered words is presented at the same window (Please see the interface below). I couldn’t think of another way to avoid updating the window at every iteration
I am not sure if that is what you meant by pyglet text update!?
Do you think installing the recent version of Pyglet library will solve the problem?

Many Thanks