| Reference | Downloads | Github

BufferImageStim related problem

Dear Psychopy Experts,

The following codes elicits errors on my win7 x64 system with Psychopy 1.83.04 installed in the Canopy 32bit environment :

from psychopy import visual
w = visual.Window()
b = visual.BufferImageStim(w)

The output:

Exception                                 Traceback (most recent call last)
 in ()
----> 1 b = visual.BufferImageStim(w)

ferimage.pyc in __init__(self, win, buffer, rect, sqPower2, stim, interpolate, flipHoriz, flipVert, mask, pos, name, aut
    132         glversion =
    133         if glversion >= '2.1' and not sqPower2:
--> 134             region = win._getRegionOfFrame(buffer=buffer, rect=rect)
    135         else:
    136             if not sqPower2:

dow.pyc in _getRegionOfFrame(self, rect, buffer, power2, squarePower2)
    952         #GL.glGetTexImage(GL.GL_TEXTURE_1D, 0,
    953         #                 GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, bufferDat)
--> 954         im = Image.fromstring(mode='RGBA', size=(horz, vert), data=bufferDat)
    955         region = im.transpose(Image.FLIP_TOP_BOTTOM)

c:\users\audachang\appdata\local\enthought\canopy32\user\lib\site-packages\PIL\Image.pyc in fromstring(*args, **kw)
   2061 def fromstring(*args, **kw):
   2062     raise Exception("fromstring() has been removed. " +
-> 2063                     "Please call frombytes() instead.")

Exception: fromstring() has been removed. Please call frombytes() instead.

I’ve tried upgrade all packages related to the Image module but still having this error. Any suggest to get around this problem? Perhaps by changing all my images to sqPower of 2 in its dimensions?



This is a version clash; your installation is using a newer version of PIL (the image library) than the one PsychoPy was written for. We’ve changed the PsychoPy code to be compatible with that (will be part of the 1.84 release very shortly).

I don’t remember, does canopy include the .py files of the psychopy library or just the pyc files? If you want to update this before the new version is formally released then you could potentially remove the psychopy lib entirely from your canopy site-packages and replace it with one from psychopy on github