| Reference | Downloads | Github

OverflowError: timeout value is too large and wierd bloop sound when using float as end time


I am hitting a wall with what seemed to be an easy task. I have an experiment, mostly done with code component, where I have to specify the end time. Until now I had this end time as integer but I noticed in my data that some of the end times are not correct, so I decided to use floats instead. However, if I use floats then I receive an “OverflowError: timeout value is too large” error and a wierd “bloop” sound at the end of each trial.

More specifically: I have audio files with operations and ISIs between operations/audios of at least 3.6s (ISIs are specified in excel file and read in psychopy). I noticed that sometimes after the last audio file the trial ends before the necessary 3.6s. Further, I realized this happens because my end time is specified as integer, which sometimes rounds the number down. I tried importing “math” and using “math.ceil” but both the sound and error presist.

I am wondering if there is a way to get the correct end time (not rounded down) without getting this Overflow error? I need to specify the end time in order to stop the Routine at appropriate time.

Example of my code (isi_operation and operation_audio are defined in conditions file):

t1 = 2
t2 = t1+isi_operation[0]
t3 = t2 + isi_operation[1]
t10 = t9 + isi_operation[8]

audio1 = operation_audio[0]
audio2 = operation_audio[1]
audio9 = operation_audio[8]

if len(operation_audio)==9:
    endt = int(t10)

if len(operation_audio)==10:
    audio10 = operation_audio[9]
    t11 = t10 + isi_operation[9]
    endt = int(t11)

Thank you!