Hi Jens,
Thank you so much for your elaborate response!
I put different JS and Py code in the builder.
JS code =
function random_character() {
var chars = “ABCDEFGH”;
return chars.substr( Math.floor(Math.random() * 8), 1);
}
condition = random_character();
I however realised now that actual problem is that the online task is trying to use an old js-script, because there are some problems with exporting the html code of the current version of the experiment.
I think there are still some problems with ‘condition’ (see traceback below). I tried your JS code as well, but the issue is still there. The task works fine offline.
The code randomly picks a character, and this character refers later on to a specific task Version (name of loop for instance: 'Version' + condition + '_Precond_USrating.xlsx').
I have a few double loops (inner and outer loop) by which the order of two blocks is randomly selected (outer loop for example ‘Version’ + condition + ‘_selectBlock_conditioning.xlsx’); inner loop refers to a condition (condfile_conditioning) that is specific in the (‘Version’ + condition + ‘_selectBlock_conditioning.xlsx’)-file).
I was wondering if you have an idea what error the Traceback code refers to and how the errors can be solved.
Many thanks and best,
Iris
Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 782, in findPathsInFile
File “”, line 1, in
NameError: name ‘condition’ is not defined
During handling of the above exception, another exception occurred:
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 1221, in onPavloviaSync
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 719, in fileExport
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 73, in generateScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 242, in compileScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 214, in _makeTarget
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 213, in writeScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/flow.py”, line 290, in writeFlowSchedulerJS
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 830, in getResourceFiles
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 796, in findPathsInFile
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 782, in findPathsInFile
File “”, line 1
/Users/iris/Documents/MSCAIF_WP34/PsychPy_Exp_Dec2020/~$conditions_conditioning_block2.xlsx
^
SyntaxError: invalid syntax