Hi guys, I’m trying to code up an experiment that shows images, with text overlaid on it.
I created an excel spreadsheet looking like this:
This is the file I’m trying to use.
I get an error message saying:
OSError: Couldn’t find image imageFile; check path? (tried: C:\Users\Sophie\OneDrive\Spring '19\Research\PsychoPy\Bejj\imageFile)
Is there anything wrong with my code? These are the bits I think are relevant:
thisExp = data.ExperimentHandler(name=expName, version='',
extraInfo=expInfo, runtimeInfo=None,
originPath=None,
savePickle=True, saveWideText=True,
dataFileName=filename)
# save a log file for detail verbose info
logFile = logging.LogFile(filename+'.log', level=logging.EXP)
logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a file
endExpNow = False # flag for 'escape' or other condition => quit the exp```
and later...
#read stimuli file
trials = open('cog2.csv', 'r')
imageFile = 0 #imageFile = trials[trialNumber][Column]
corrAns = 1 #corrAns = trials[trialNumber][Column]
Congruent = 2 #Congruent = trials[trialNumber][Column]
stimCat = 3 #stimCat = trials[trialNumber][Column]
Superimposed = 4 #Superimposed = trials[trialNumber][Column]
Word = 5 #word = trials[trialNumber][Column]
#turn the text string into stimuli
textStimuli = []
imageStimuli = []
for trial in csv.reader(trials):
textStimuli.append(visual.TextStim(win, text=trial[Word]))
imageStimuli.append(visual.ImageStim(win, size=[0.5, 0.5], image=trial[imageFile]))