Issues with code component using "random" online; unable to prepare trial list

URL of experiment: Pavlovia
(still piloting)

GitLab: Sign in · GitLab
(internal free access)

Version running: 2022.2.5
Bulider version: 2023.1.2 (set to 2022.2.5)
older versions of the experiment run smoothly online with one trial and without randomization under version 2020.2

Description of the problem:
Aim: participant randomization on three list for three looped trials.
(Overall 9 excel sheets with different names; in each trial participant are supposed to be randomly assigned to one of three lists - worked fine offline)
Experiment loads large amount of audio and sound stimuli

The experiment runs smoothly online - until trial lists need to be read for the randomization based on a code component. Developer tools (Mozilla) also indicate there is an issue with the code component. I attached the Error messages of Pavovia, the developer tools and the code component below.

I checked: All variable names are denoted unquely to avoid confusions.
Condition-Excel-Files are loaded at the beginning as addtional resources (via online settings). I’m not entirely sure what the error message is referring to.

I suspect a mistake in loop settings, code component or resource handling, or the Psychopy Version control - but I need help.

Does anybody have a tip for me?
Bildschirmfoto 2023-06-06 um 07.55.12

Bildschirmfoto 2023-06-06 um 11.53.44


add a


command to your code-component to check the value of the variable condition. This code does not work for me. random does not take strings as an argument. Also, random takes only one argument (number of floating numbers between 0 and 1 to be generated), not three.

So, try this instead.

cond = ['A', 'B', 'C']

condition = "wpm_exp_test_" + cond[0] + ".xlsx"

Best wishes Jens

1 Like

Thanks! It worked!
Had to rearrange my resources a bit (reduce subfolders) but now it runs smoothly!