Psychopy to pavlovia error

URL of experiment:

Description of the problem:

Hey all,

so I have created an experiment using the latest version of PsychoPy and it works well when I run it with builder. However, when I run it through pavlovia it gives me the error below. The task is one where participants need to type in a word, I created a customized code for it so that the answer would display in the screen. Does anyone know why it is giving me this error?

Unfortunately we encountered the following error:

  • **TypeError: ‘’.join is not a function. (In ‘’’.join(key_resp_12.keys)’, ‘’’.join’ is undefined)**z

.join is a method. Shouldn’t the syntax be key_resp_12.keys.join() ?

Thanks, wakecarter. I have this in the builder so that it gives me the text they type. I followed a tutorial and it seemed to work in the builder version. What would you suggest I change this to?

Ah. I think I see the problem.

In Python the syntax is delimeter.join(array) and in JavaScript the syntax is array.join(delimeter)

How about

for Idx in range(len(array)):
    displayText +=array[Idx]

this the bit of code I have in “each frame”

if templist.count(‘return’)==1:
elif templist.count(‘space’)==1:
elif templist.count(‘lshift’)==1:
elif templist.count(‘backspace’)>=1 and len(key_resp_12.keys)>=2:
elif templist.count(‘backspace’)>=1 and len(key_resp_12.keys)==1:
elif (len(key_resp_12.keys)-1) == numkeys:

I do not seem to make this work…

Can I add this code by using the “code component” or do I have to make in the coder itself?

Thank you in advance!

I never use the coder and strongly discourage it for online experiments.


I couldn´t make it work. I will use images again since they are now working.

Thank you for your help!

Hi @wakecarter thanks for your advice on my digit span. I have now ran into another error with using ‘join’

I get the following error * TypeError: Cannot read property ‘join’ of undefined

Any advice is much appreciated, I am very new to all of this!


The error is related to the line

current_resp = key_resp_2.keys.join('');

The issue is that you need to only execute this line if at least one key has been pressed.

You could try

if key_resp_2.keys:
     current_resp = key_resp_2.keys.join('');


if (_key_resp_2_allKeys.length > 0)

as I suggested here. Cannot read property 'length' of undefined (getting typed response on Pavlovia) - #5 by wakecarter