Automated psychopy code failing to find necessaery packages

Hi I’m a new psychopy user. I’m trying to debug some code for someone else, and it seems the program they gave me is calling other programs that are built into psychopy. These further rely on certain files that are possibly not in the same directory I’m using. Here is the error message:

Welcome to PsychoPy2!
v1.85.4
()

Running: C:\Users\Phil Gigliotti\Dropbox\Psychopy\Cyberball Working PG.py

pyo version 0.8.7 (uses single precision)
6.0776 ERROR avbin.dll failed to load. Try importing psychopy.visual
as the first library (before anything that uses scipy)
and make sure that avbin is installed.
12.3790 WARNING Monitor specification not found. Creating a temporary one…
12.3794 WARNING User requested fullscreen with size [800 600], but screen is actually [1920, 1080]. Using actual size
13.0932 ERROR Couldn’t find image cyberballimages/catchright.png; check path? (tried: C:\Users\Phil Gigliotti\Dropbox\Psychopy\cyberballimages\catchright.png)
Traceback (most recent call last):
File “C:\Users\Phil Gigliotti\Dropbox\Psychopy\Cyberball Working PG.py”, line 91, in
participant = visual.ImageStim(myWindow, pos= (0, -.5), image= imageDir + ‘catchright.png’ )
File “C:\Users\Phil Gigliotti\psychopy\PsychoPy2\lib\site-packages\psychopy\visual\image.py”, line 97, in init
self.setImage(image, log=False)
File “C:\Users\Phil Gigliotti\psychopy\PsychoPy2\lib\site-packages\psychopy\visual\image.py”, line 289, in setImage
setAttribute(self, ‘image’, value, log)
File “C:\Users\Phil Gigliotti\psychopy\PsychoPy2\lib\site-packages\psychopy\tools\attributetools.py”, line 137, in setAttribute
setattr(self, attrib, value)
File “C:\Users\Phil Gigliotti\psychopy\PsychoPy2\lib\site-packages\psychopy\tools\attributetools.py”, line 27, in set
newValue = self.func(obj, value)
File “C:\Users\Phil Gigliotti\psychopy\PsychoPy2\lib\site-packages\psychopy\visual\image.py”, line 276, in image
forcePOW2=False)
File “C:\Users\Phil Gigliotti\psychopy\PsychoPy2\lib\site-packages\psychopy\visual\basevisual.py”, line 794, in _createTexture
raise IOError, msg % (tex, os.path.abspath(tex))
IOError: Couldn’t find image cyberballimages/catchright.png; check path? (tried: C:\Users\Phil Gigliotti\Dropbox\Psychopy\cyberballimages\catchright.png)

When I click on the file in the line 794 bar that triggers the error, it takes me to a new script that I’ve never seen called basevisual.py. line 794 is part of a 500 line block of code about “texture mixing.” the actual section with line 794 looks like this:

    else:
        if type(tex) in [str, unicode, numpy.string_]:
            # maybe tex is the name of a file:
            filename = findImageFile(tex)
            if not filename:
                msg = "Couldn't find image %s; check path? (tried: %s)"
                logging.error(msg % (tex, os.path.abspath(tex)))
                logging.flush()
                raise IOError, msg % (tex, os.path.abspath(tex))
            try:
                im = Image.open(filename)
                im = im.transpose(Image.FLIP_TOP_BOTTOM)
            except IOError:
                msg = "Found file '%s', failed to load as an image"
                logging.error(msg % (filename))
                logging.flush()
                msg = "Found file '%s' [= %s], failed to load as an image"
                raise IOError, msg % (tex, os.path.abspath(tex))

Any ideas?

  1. You can ignore the avbin.dll error unless you are showing movies.
  2. The error that is causing problems here is simply a failure to find an image file.

PsychoPy is looking for:

C:\Users\Phil Gigliotti\Dropbox\Psychopy\cyberballimages\catchright.png

but can’t find it. Where is it?

The relative path specified is:

 cyberballimages/catchright.png

This means that PsychoPy expects to find it in a subdirectory called cyberballimages which is itself in the same folder as your experiment (i.e. .psyexp file). Shift that folder and its contents to the right place and everything should be fine.