| Reference | Downloads | Github

Psychopy Builder erroneously codes texRes as a float instead of an integer

If one creates a bare-bones .psyexp by inserting only a Noise or Dots stimulus into the timeline (attached), I find I get this error when running:

TypeError: ‘float’ object cannot be interpreted as an integer

test.psyexp (5.6 KB)

The reason is that Psychopy (at least version 2021.1.2 and 2021.1.4) for Noise auto-translates the texRes parameter, which is written as “128” in the Builder parameters, into “128.0”, and for Dots auto-translates the “100” nDots as “100.0”. But texRes and nDots must be integers, so this creates an error. People seem to have also reported this here and here (without identifying the underlying problem).

Somehow the magic that is the PsychoPy Builder → Python code generation previously seems to have known that the texRes parameter should be an integer, but no longer knows that.

While we wait for a fix, people with this problem can fix it manually by going to the auto-generated Python code and removing the decimal point from nDots or texRes.

Note that the Builder’s Noise demo works, even though creating a psyexp with Noise from scratch does not.