psychopy.org | Reference | Downloads | Github

TypeError: right is not an object (evaluating left in right)

Hi, I’ve got a problem with running my experiment online. Everything works fine with builder.

The routine consists of an image with a slider (rating, radio) above it where. Participants should make a decision and end the routine with spacebar.
The slider is visible but after I clicked the first of the two options I can’t end it with spacebar and also can’t change my decision anymore.

I get the error message in the title and wonder what it means because I searched for the first part and got to this question:
https://discourse.psychopy.org/t/typeerror-undefined-is-not-an-object/12651
But different from her, I can’t figure out which components are meant in my study with “right” and “left”.

Has anyone an idea? If more details are needed, I can provide them

Have you gone through Wakefield’s cribsheet already? He’s compiling a list of things that you should edit in your Builder’s code (Python to JS translation) before it works online. There’s a lot of stuff in there that might help you.

Thanks Elise. I try this later.

Hey Elise,

I’ve gone through it now but haven’t found anything that could explain my problem. Was there any specific part that helped you?

Or is there someone else who knows what to do with this error message? @dvbridges maybe?
What I don’t get is what should be this “right”. Nothing in my experiment is called so.

Hi Bubu,

I’m not an expert myself on PsychoPy but I’m willing to take a look at your experiment if you can upload it online on github and make it public? I can go through it to see if there’s anything there I had to change as well.

Do you get an error with a line number in the JavaScript console? If so, what is the code in and around that line? I’ve not tried sliders myself yet so I don’t know if right is used in the slider objects (or perhaps mouse buttons).

Given that Googling your error message (i.e. outside this forum) doesn’t turn up anything, it does seem likely that your experiment is using the words right and left to mean something (even if you haven’t added them intentionally).

Hey wakecarter

I thought the same when I realised that the error doesn’t show up anywhere else. However in my script from Builder it doesn’t appear anywhere. How can I see the JavaScript console? Maybe you can also try the link that I sent to Elise

if (textAgeFeedback.status === PsychoJS.Status.STARTED){ // only update if being drawn
    textAgeFeedback.setText(screen_text);
  }
  var _pj;
  function _pj_snippets(container) {
      function in_es6(left, right) {
          if (((right instanceof Array) || ((typeof right) === "string"))) {
              return (right.indexOf(left) > (- 1));
          } else {
              if (((right instanceof Map) || (right instanceof Set) || (right instanceof WeakMap) || (right instanceof WeakSet))) {
                  return right.has(left);
              } else {
                  return (left in right);
              }
          }
      }
      container["in_es6"] = in_es6;
      return container;
  }
1 Like

Was there no problem with the routine before? The one that shows the two options to click? Cause this is where the error message occurs for me

It seems like the problem is with the next routine where I wanted to display the keyboard input to the subjects. Is there any good instruction/thread how to do this correctly for online studies? Cause my version worked fine offline but it seems that I need another approach now

Hi

I didn’t try running it…just looked for left and right in the code.

I display user input back to participants using displayText.text=recordedString in Each Frame but only if there has been a change. displayText.setText(recordedString) might work too.

I’m not sure why you set my previous reply as the solution.

That was by mistake. I only wanted to like it because I was happy that you found the right and left. Sorry

I try the display text later. Thanks so far.

You may find this post useful. I’ve linked to my template which includes an age question

Hey yeah, that sounds great. Since I’m a beginner here can you tell me how to implement it in my experiment. Unfortunately I can’t click the code component for the age question and see what you have written there :neutral_face: