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

OS (e.g. Win10): Mac
PsychoPy version (e.g. 1.84.x): v2022.2.4

Hello! I am trying to run an online task with Psychopy. It is an image rating type. After one trial runs, I get this message. I am assuming a value is missing, maybe it is defined as “none,” but I am unsure where I should fix it and what I should input it to. Or if an additional loop is needed for the trial/the loop needs to be bigger? Any guidance is appreciated

if tThisFlipGlobal > text_2.tStartRefresh + ISI_Dur-frameTolerance:

TypeError: unsupported operand type(s) for +: ‘float’ and 'NoneType’TypeError: unsupported operand type(s) for +: ‘float’ and ‘NoneType’

— Run Routine “ISI” —

    while continueRoutine:
        # get current time
        t = routineTimer.getTime()
        tThisFlip = win.getFutureFlipTime(clock=routineTimer)
        tThisFlipGlobal = win.getFutureFlipTime(clock=None)
        frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
        # update/draw components on each frame
        
        # *text_2* updates
        if text_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
            # keep track of start time/frame for later
            text_2.frameNStart = frameN  # exact frame index
            text_2.tStart = t  # local t and not account for scr refresh
            text_2.tStartRefresh = tThisFlipGlobal  # on global time
            win.timeOnFlip(text_2, 'tStartRefresh')  # time at next scr refresh
            # add timestamp to datafile
            thisExp.timestampOnFlip(win, 'text_2.started')
            text_2.setAutoDraw(True)
        if text_2.status == STARTED:
            # is it time to stop? (based on global clock, using actual start)
            if tThisFlipGlobal > text_2.tStartRefresh + ISI_Dur-frameTolerance:

Hi @Mary_Mousa, as a first step you could insert

print(tThisFlipGlobal)
print(text_2.tStartRefresh)
print(ISI_Dur)
print(frameTolerance)

right before the if statement to print the values to the console and see, which one of these is “None”.

Hello, I encountered a similar problem, I found that when I printed out the variable ISI, I found that after the end of a block, that is, after the end of the last condition as a block, its value changed to None, I don’t know why?

Here is the line of code where my program went wrong:

Below are the printed results and errors: