psychopy.org | Reference | Downloads | Github

IOError: Couldn't find image - Not the Usual

**** please delete - I found the problem (empty line in the text file from which the images were loading)

Hello,
Thank you for trying to help.

I am coding an experiment and the code is very long and complicated so I cant really post it here.
In the relevant part the program should display 2 images on either side of the screen.
Once in a while (I still cant figure out when) the program crashes with the following error which seem to be in the “backstage” of psychopy.

I have checked many times the usual suspects:

  • The images are in fact in the same folder and in the correct path.
  • There are no files with the same name or same folder name.
  • There should be no reason for a .png.png kind of problems

The full error it raised:

File “G:/My Drive/Common lab folder/decision making/experiment_april_2019/June.py”, line 61, in display_2stimulus
pos=[0.5, 0]
File “C:\Python27\lib\site-packages\psychopy\visual\image.py”, line 102, in init
self.setImage(image, log=False)
File “C:\Python27\lib\site-packages\psychopy\visual\image.py”, line 301, in setImage
setAttribute(self, ‘image’, value, log)
File “C:\Python27\lib\site-packages\psychopy\tools\attributetools.py”, line 141, in setAttribute
setattr(self, attrib, value)
File “C:\Python27\lib\site-packages\psychopy\tools\attributetools.py”, line 32, in set
newValue = self.func(obj, value)
File “C:\Python27\lib\site-packages\psychopy\visual\image.py”, line 288, in image
forcePOW2=False)
File “C:\Python27\lib\site-packages\psychopy\visual\basevisual.py”, line 814, in _createTexture
raise IOError(msg % (tex, os.path.abspath(tex)))
IOError: Couldn’t find image ; check path? (tried: G:\My Drive\Common lab folder\decision making\experiment_april_2019)

Thank you in advance,
Shahar

Hi @Shahar_Lahad, glad you found the solution. It will be useful to keep this up for other users who might experience the same issue, if that is ok.

I loaded the images from a text file which contained an empty line at the end so once in while the program loaded an empty line and assigned it to what was suppose to be an image.