Issue with Posner paradigm, 'Nonetype object is not subscriptable error

Hello everyone,

as excercise I am trying to follow the tutorial of psychopy in order to create the Posner paradigm through the coder (link: Coding a full experiment — Workshops).

So, I’m trying to go on, I arrived at the point when i import the .csv file created in Excel, but it doesn’t work.

Here it is the code:

from psychopy import visual, event, core, data, gui

info = {} #a dictionary
info[‘fixTime’] = 0.5 # seconds
info[‘cueTime’] = 0.2
info[‘probeTime’] = 0.2

win = visual.Window([1536,864], fullscr=True, units=‘pix’)

#initialise some stimuli
fixation = visual.Circle(win, size = 5, lineColor = ‘white’, fillColor = ‘lightGrey’)

#run one trial
fixation.draw()
win.flip()
core.wait(info[‘fixTime’])

cue = visual.ShapeStim(win,
vertices = [[-30,-20], [-30,20], [30,0]],
lineColor = ‘red’, fillColor = ‘salmon’)

cue.draw()
win.flip()
core.wait(info[‘cueTime’])

probe = visual.GratingStim(win, size = 80, # ‘size’ is 3xSD for gauss,
pos = [300, 0], #we’ll change this later
tex = None, mask = ‘gauss’,
color = ‘green’)

probe.draw()
win.flip()
core.wait(info[‘probeTime’])

conditions = data.importConditions(‘conditions.csv’)
trials = data.TrialHandler(trialList=, nReps=5)
for thisTrial in trials:
code to run one trial here
probe.setPos( [thisTrial[‘probeX’], 0] )
cue.setOri( thisTrial[‘cueOri’] )
fixation.draw()
win.flip()
core.wait(info[‘fixTime’])

cue.draw()
win.flip()
core.wait(info['cueTime'])

probe.draw()
win.flip()
info['probeTime']

Then I remove the lines which don’t allow the code to work properly, in other words to do several trials and change the direction of the cue and the position of the probe.

Here what I did:

from psychopy import visual, event, core, data, gui

info = {} #a dictionary
info[‘fixTime’] = 0.5 # seconds
info[‘cueTime’] = 0.2
info[‘probeTime’] = 0.2

win = visual.Window([1536,864], fullscr=True, units=‘pix’)

#initialise some stimuli
fixation = visual.Circle(win, size = 5, lineColor = ‘white’, fillColor = ‘lightGrey’)

cue = visual.ShapeStim(win,
vertices = [[-30,-20], [-30,20], [30,0]],
lineColor = ‘red’, fillColor = ‘salmon’)

probe = visual.GratingStim(win, size = 80, # ‘size’ is 3xSD for gauss,
tex = None, mask = ‘gauss’,
color = ‘green’)

conditions = data.importConditions(‘conditions.csv’)
trials = data.TrialHandler(trialList=, nReps=5)
for thisTrial in trials:
code to run one trial here
probe.setPos( [thisTrial[‘probeX’], 0] )
cue.setOri( thisTrial[‘cueOri’] )
fixation.draw()
win.flip()
core.wait(info[‘fixTime’])

cue.draw()
win.flip()
core.wait(info['cueTime'])

probe.draw()
win.flip()
info['probeTime']

The line that don’t work is this one: probe.setPos( [thisTrial[‘probeX’], 0] ) it gives this error: ‘NoneType’ object is not subscriptable.

I don’t know how to fix it and make the code running.

Thanks in advance for your help. I attach the csv file
conditions.csv (194 Bytes)