| Reference | Downloads | Github

Duration (frames) Error

Hi everyone,
Have an initialization screen where you have to click to continue, then a buffer screen comes up that lasts one second (this is the only screen that has a specific time and does not end with a click). I am using the stop for the stimuli on the buffer screen set to “duration (frames): int(1000/(1000/expInfo[‘frameRate’]))” equivalent to one second. I use something similar on many stimuli, varying the first 1000 to change the timing for different components, however, all those screens end with a click eventually. This seems to work well on everything, except for on that buffer screen. I get the error: TypeError: unsupported operand type(s) for /: ‘int’ and ‘NoneType’. However this does not happen all the time, just some of the time. It seems like if I click too quickly or too slowly on the initialization screen that’s when I get the error as it try’s change over to the buffer screen.
-Why does it not recognize ‘int’? It is a regular python function.
-How does it work fine most of the time and not get this error?
-Why does this error not happen on all the other stimuli I have with their durations set similarly?

Thanks for any advice,

The error
TypeError: unsupported operand type(s) for /: ‘int’ and ‘NoneType’.
is not cause by converting to the int with int(). It most probably refers to the the piece that says:
The problem is probably that expInfo['frameRate'] is None on the occasions where you’re having a problem so Python is trying to do 1/None and gives you that error.

I can’t tell you why expInfo['frameRate'] is None from the code you’ve shown us but expInfo['frameRate'] is normally calculated from measuring the screen refreshes at the start (of a Builder experiment) so maybe you’ve done something with that code that has caused this side-effect?