psychopy.org | Reference | Downloads | Github

TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

OS: Mac 10.15.3
PsychoPy version: 3
Standard Standalone? (y/n) If not then what?:
**What are you trying to achieve?: Visual cueing experiment

I have a png that I manage to get to switch orientations using an Excel file on a loop. Then I add an ISI and somewhere along the line I get this error. Once I have the error, it seems to persist whatever I do. I don’t have any of my own code in the experiment, it’s all just Psychopy.

Red_Arrow_Pointing_Right.setOri(Orientation)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/visual/basevisual.py”, line 1379, in setOri
setAttribute(self, ‘ori’, newOri, log, operation)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/tools/attributetools.py”, line 141, in setAttribute
setattr(self, attrib, value)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/tools/attributetools.py”, line 32, in set
newValue = self.func(obj, value)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/visual/basevisual.py”, line 1255, in ori
radians = value * 0.017453292519943295
TypeError: unsupported operand type(s) for *: ‘NoneType’ and ‘float’

Thanks

Dan

Somehow your Orientation variable is getting set to None rather than containing a number. Firstly check your conditions file for any blank cells.

Otherwise, try inserting a code component and at relevant points (e.g. in the “begin routine” tab), put something like:

print(Orientation)

to see what the current value is, and if it meets what you think it should be.

Thank you so much Michael