URL of experiment: https://pavlovia.org/run/juliankl/finalorteng9/html/
Gitlab: Julian Kirkeby Lysvik / finalorteng9 · GitLab
Experiment created using builder on Windows, version 3.0.4.
When running my experiment I get the following error:
Looking online I suspect the error could be related to a code component in my builder which allows me to register and display participant input, live. The Python code is the following (from: GitHub - jacanterbury/PsychoPy-snippets: Some PsychoPy example scripts & snippets for easy sharing)
#Begin experiment
inputText = ""
#Begin routine
theseKeys=""
shift_flag = False
txtinp.alignHoriz ='center'
#Each frame
n= len(theseKeys)
i = 0
while i < n:
if theseKeys[i] == 'return' and len(inputText) >1:
# pressing RETURN means time to stop
continueRoutine = False
break
elif theseKeys[i] == 'backspace':
inputText = inputText[:-1] # lose the final character
i = i + 1
elif theseKeys[i] == 'space':
inputText += ' '
i = i + 1
elif theseKeys[i] in ['lshift', 'rshift']:
shift_flag = True
i = i + 1
else:
if len(theseKeys[i]) == 1:
# we only have 1 char so should be a normal key,
# otherwise it might be 'ctrl' or similar so ignore it
if shift_flag:
inputText += chr( ord(theseKeys[i]) - ord(' '))
shift_flag = False
else:
inputText += theseKeys[i]
i = i + 1
#End routine
# let's store the final text string into the results file...
thisExp.addData('inputText', inputText)
inputText=""
The custom code is part of this full structure, where “textinp” displays “$inputText” from the code above.
My js-“translation” is a simple code:
#Begin experiment
function inputText() {
var x = document.createElement("INPUT");
x.setAttribute("type", "text");
x.setAttribute("value", "");
document.body.appendChild(x);
}
So I suspect the problem is my js-code. However, as far as I know it could be something else entirely. Any help would be greatly appreciated