Randomization in Pavlovia and a HTML error

I think my task is rather simple: I want to present two words on the screen. The words come from a list. PsychoPy randomly combines two words from the list and randomly presents one on the right and one on the left. Usually I create a code component that generates a new csv file for each participant. That does not work with Pavlovia (see also my recent post here: Randomizaion and the condition file in Pavlovia).

Now I had a new idea: I created a code component. Here I create my word lists (before the experiment) and randomize them. I called them “list1” and “list2”. At the beginning of the experiment I set a counter (“count = 0”) and at the end of each routine I add one (“count = count + 1”). I added a text component and added “$list1[$count]” with “set every” repeat. Everything works great.

But: When I click “Export HTML” I get an error:

Traceback (most recent call last):
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\components\_base.py", line 435, in writeParamUpdate
    valStr = str(val).strip()
TypeError: __str__ returned non-string (type NoneType)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py", line 719, in fileExport
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py", line 73, in generateScript
    compileScript(infile=exp, version=None, outfile=filename)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py", line 242, in compileScript
    _makeTarget(thisExp, outfile, targetOutput)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py", line 214, in _makeTarget
    script = thisExp.writeScript(outfile, target=targetOutput, modular=True)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\_experiment.py", line 251, in writeScript
    self_copy._currentRoutine.writeRoutineBeginCodeJS(script, modular)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\routine.py", line 285, in writeRoutineBeginCodeJS
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\components\_base.py", line 202, in writeRoutineStartCodeJS
    self.writeParamUpdatesJS(buff, 'set every repeat')
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\components\_base.py", line 405, in writeParamUpdatesJS
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\components\_base.py", line 399, in writeParamUpdates
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\components\_base.py", line 439, in writeParamUpdate
    raise TypeError(f"Value of parameter {paramName} of component {compName} "
TypeError: Value of parameter text of component first_names could not be converted to JS. Value is $list1[$count]

I understand that there is a problem with “$list1[$count]”. And I probably need to change this to make Javascript understand what I want. But I don’t know how. Any help would be greatly appreciated (but note that I am not very familiar with programming :sweat_smile:).