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

OS (e.g. Win10): win11
PsychoPy version (e.g. 1.84.x): v2022.2.5
Standard Standalone? (y/n) If not then what?:y
What are you trying to achieve?:
I wish to run an experiment with two condition files, one containing the chunk information and one containing all the trials for a single block.
But 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?Any help would be greatly appreciated!!

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


Below are the printed results and errors:

I encountered the same problems when using variable jitter time and the error was same. Have you solved this error?

File "C:\Users\admin\Desktop\erp程序marker\erp_exp_无voicekey_lastrun.py", line 468, in <module>
    if tThisFlipGlobal > I_jitter.tStartRefresh + jitter_time-frameTolerance:
TypeError: unsupported operand type(s) for +: 'float' and 'NoneType'
################ Experiment ended with exit code 1 [pid:131236] ################

Try printing out these values to work out which is undefined (and when).

print('tThisFlipGlobal', tThisFlipGlobal)
print('I_jitter.tStartRefresh',I_jitter.tStartRefresh)
print('jitter_time', jitter_time)
print('frameTolerance', frameTolerance)

Hello, I have found the reason for my mistake. That’s kind of funny. I found that when I was creating a condition file, an excel file, I would copy hundreds of rows of conditions at once and then delete a few of them. However, when the experiment is run, these deleted empty lines are still treated as a condition, so when the program calls the variables of these lines, the program will show the above error. I don’t know if this has happened to you, but if so, you can try recreating a conditional file, and make sure that the number of rows you keep is greater than or equal to the number of rows you originally created. The best way is to create the required number of lines in your condition file at once, and do not arbitrarily change the number of lines, but the variables of each line can be arbitrarily changed.

Hope the above suggestions are helpful to you, best wishes.

Hello, it’s the same mistake!!! I recreated the condsfile, and solved the mistake. Thanks so much~