TypeError: Cannot read properties of undefined (reading "toString")

URL of experiment: si_transfer_Simon_long_exp [PsychoPy]

Description of the problem:


I got this TypeError: Cannot read properties of undefined (reading “toString”).
I didn’t have any error when testing the program locally with Python code.
I also see the variable “stim_1” and “stim_2” has already been defined before where the error occur.


When I removed “str()” from the python code given that my variable “stim_1” and “stim_2” are already strings, the blankspace of these variable were filled with “undefined”… It can shows the specific color words if running locally with Python. However, in the routine before this routine, I have already defined stim_1 and stim_2 with “if” function. So what is the problem here?

Put stim_1 = '' and stim_2 = '' in a Begin Experiment tab (or indeed anywhere before you try to give them values in if clauses).

I realized it was actually another mistranslation from Python to JavaScript before this routine, so the variable stim_1 and stim_2 are actually “NaN”. That’s why toString() didn’t work at all. I solved it anyway. Thank you!

1 Like