| Reference | Downloads | Github

AttributeError: Couldn't make sense of requested image

Mac OS
Version: 1.8

I have an excel spreadsheet with paths to images saved on my computer. I created a random loop in my PyschoPy program which calls this excel file. I also created an image stimulus, for which the start time is 0.0 s and the duration is $startVal (which is the a column in my excel sheet). For the image box, I am calling $file (which is the header for the column that contains the file paths in the excel sheet).

I double checked the file paths and they are all correct, but I still get the following error:

############## Running: /Users/samikshasm/Desktop/ ##############
0.4592 WARNING Movie2 stim could not be imported and won’t be available
4.9572 ERROR Couldn’t make sense of requested image.
saved data to u’/Users/samikshasm/Desktop/data/sam_cana_2016_Nov_08_0859.csv’
Traceback (most recent call last):
File “/Users/samikshasm/Desktop/”, line 102, in
texRes=128, interpolate=True, depth=-7.0)
File “/Applications/”, line 89, in init
self.setImage(image, log=False)
File “/Applications/”, line 261, in setImage
setAttribute(self, ‘image’, value, log)
File “/Applications/”, line 100, in setAttribute
setattr(self, attrib, value) # set attribute, calling attributeSetter if it exists
File “/Applications/”, line 20, in set
newValue = self.func(obj, value)
File “/Applications/”, line 249, in image
maskParams=self.maskParams, forcePOW2=False)
File “/Applications/”, line 661, in _createTexture
raise AttributeError, “Couldn’t make sense of requested image.”#ensure we quit
AttributeError: Couldn’t make sense of requested image.

This is what my excel file looks like (I do not want circle/square to have a path. That’s why the file paths are none. I also tried creating a path to an image for the circle and the square to see if the “none” is what is causing the error. But that didn’t work either.)

I don’t have time at the moment to look deeply at this, but ‘file’ is a special word in python. You’re going to want to change the name of that column and variable, maybe to something like $fileName .

EDIT: I looked at this and I was wrong. Apparently Psychopy is smart enough to avoid this potential problem.

ANOTHER EDIT (After Jon’s reply below). So it seems like I might have been right on this one. $file is not a good column name :slight_smile: . Just putting this here so it’s extra clear to future readers.

But using “none” in your excel sheet won’t work either. Psychopy will read this in as a string “none”, not python’s None object. It’s going to look for an image file named “none”.

EDIT: Disregard this post too, I stand corrected. I took a look at the docs and using “none” shouldn’t cause an error. I made a little test experiment, and putting “none” as the value for the image did not cause an error, and no image was shown (as expected).

Kudos to the developers for these intuitive features, but unfortunately this means I don’t know what your problem is.

Just for reference, could you be more specific about your version number (i.e. 1.84.2, not just 1.8), and maybe attaching your conditions file and your image file might help. What happens if you use a different image file?

Haha, thanks Dan.

The second issue (the fact that “none” is a valid way to specify no stimulus in a conditions file is credit to us :wink: We guessed a few options that people might put in there.

We can’t take credit for the former issue. The fact that file doesn’t usually cause a problemis just that python’s variables are local and file isn’t used in the rest of the Builder-compiled script so it can indeed be used here without conflict. But my suspicion here is that file is indeed being used somewhere else in this study, as well as being used in the conditions file. @samikshasm do you have any code components?

If it were simply not finding the file the error message would be different. This error is caused because file is not a string when you try to use it.

You may need to create a “minimal working example” of the error occurring, where you have just the rows that fail included and, preferably, no other stimuli and no other code components. If that minimal experiment runs then gradually add bits of your experiment back until it stops working again.