Variables from condition file redeclared in JS

URL of experiment: Abbey Roelofs / OAPractice_v2 · GitLab

Description of the problem:
This experiment has an outer loop (“block”) where the condition file contains one variable, condsFile, which contains the name of the conditions file to use in the inner loop (“trials”). The conditions file for the trials loop contains (among other things) variables named word1, word2, … word8. These contain lists of words and in some cases blanks. The files and variables are all loading correctly.

What didn’t work was that blank words were displaying as the string “NaN” instead of blanks, even after updating to the latest version of PsychoPy as suggested here (this is the same project, and we’re now using PsychoPy 2020.2.8). We followed a post here and added JS code at the beginning of the display routine to check for an empty value in each word and replace it with the string " ". However, this resulted in none of the words showing up, and it seems to be because when this code is added, the word1, word2, … word8 variables from the condition file are redeclared in the compiled JavaScript file (see lines 1679-1685 of the .js file). We fixed this by just deleting those lines after compiling and before syncing, but is there some other underlying reason this is happening or a better way to fix it?

Thanks in advance!