OS (e.g. Win10): Mac 11.2.1
PsychoPy version (e.g. 1.84.x): v2021.1.1
Standard Standalone? (y/n) If not then what?: yes
What are you trying to achieve?: javascript conversion
Experiment Link: Pavlovia (though note that the oinline version won’t work because of the JS problem)
So this is an odd one: Custom Code element works fine, but the inclusion of any “if” statement (e.g., “if (1 === 1) {}”) in the javascript side generates the following error:
“Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 692, in fileSave
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 759, 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 265, in writeScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/routine.py”, line 287, in writeRoutineBeginCodeJS
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/code/init.py”, line 231, in writeRoutineStartCodeJS
TypeError: str returned non-string (type NoneType)”
In turn, the javascript file won’t update.
Same behaviour occurs for other reserved keywords (e.g., var, for, etc.). Simply defining variable, however (e.g., test = 0;) is fine.