Looping through images in Excel files

Hello!

I have written a piece of code at the start of the experiment to randomise an image pathway to a variable name.

I want to loop through an excel file which contains a list of these variable names, but I need the image associated with these variables to be presented.

They are not being presented, instead an error shows that the filename directory cannot be found.

Any ideas for any work arounds?

Hello,
Can you please share the code you wrote and an example of your excel file content?

if ShapeSelector == 0:
    Goodme = 'images/Circle.png'
    Badme = 'images/Star.png'
    Goodother = 'images/Diamond.png'
    Badother = 'images/Heptagon.png'
    Left1 = 'Match (A)'
    Right1 = 'Mismatch (L)'

if ShapeSelector == 1:
    Goodme = 'images/Circle.png'
    Badme = 'images/Star.png'
    Goodother = 'images/Diamond.png'
    Badother = 'images/Heptagon.png'
    Left1 = 'Mismatch (A)'
    Right1 = 'Match (L)'


if ShapeSelector == 2:
    Goodme = 'images/Circle.png'
    Badme = 'images/Star.png'
    Goodother = 'images/Heptagon.png'
    Badother = 'images/Diamond.png'
    Left1 = 'Match (A)'
    Right1 = 'Mismatch (L)'

These are three out of 47 possible examples.

I then want to associate an image with the paths by writing the variable name e.g., “Goodme” in the excel file list

Hello

something like this?

grafik

Bets wishes Jens