| 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.


When I compile to python code I can’t find anything called ‘texRes’ - has this been renamed since?

Also, if I change the code will this limit my ability to then use the builder view when building the experiment? It’s important i stay in builder view in order to launch my study online.

it’s an optional parameter, so you won’t see it in some Noise or Dots calls, so it sounds like you’re fine.
About your second question, yes every time you go from the Builder to the Coder, you would have to change it manually to an integer.
However, I believe it has now been fixed in the source code so it shouldn’t be a problem starting with the next release.

1 Like

thanks alex!

for anyone else with this issue in the mean time: I used the fix from another post which suggested using int() wrapped around nDots to solve this whilst remaining in builder view.

Hi Alex, I am having a similar error, was directed to this from having the error “Warning: expected min height of view (NSPopoverTouchBarItemButtom: 0x7f828e505c40>) to be less than or equal to 30 but got a height of 32.00000000”

However when I tried your temporary solution, my texRes does not have a decimal point and is set to 512 if that helps. I am also running off of Psychopy ver. 2020.2.9, so I don’t know why I am running into this issue on an older version.

Any ideas would be greatly appreciated. Thanks


I think the NSPopover error is unrelated and isn’t a problem.
The new version of Psychopy fixes the texRes bug, have you tried it?