Builder vs. Coder

OS: Win11 Pro, Lenovo ThinKPad COREi7
PsychoPy version: 2021.2.3
Standard Standalone? (y/n): yes

Why do some code lines that work properly in Coder, give out error in the Builder?

Example: I need a random fixation time in a defined range, and I generate it like:

fixation_time = round(random.randrange(250, 2000)/1000, 1)

It works in Coder, but in Builder, gives out the error.

if fixation_time.status == NOT_STARTED and tThisFlip >= 1.0-frameTolerance:
AttributeError: 'float' object has no attribute 'status'

What do you mean by status for a random number?

That’s the error I get. It refers to a line in the Coder script, that is apparently generated based on the Builder, but it’s not that I have coded it. I don’t know where it comes from.

I was using fixation_time + 1.0 in the Builder for an image. Now I defined it as another variable (target_time = fixation_time + 1.0) in a code component and I get this error:

File "C:\Users\zahra\Desktop\tasks\gonogo\gonogo_lastrun.py", line 293, in <module>
    thisComponent.tStart = None
AttributeError: 'float' object has no attribute 'tStart'

It was because the name of the fixation component was the same as fixation_time. It’s resolved now.

1 Like