psychopy.org | Reference | Downloads | Github

Initialising experiment

Hi!

I’m new to PsychoPy so I’m trying to figure out things that might sound very basic. I have an experiment that worked beautifully last week… When I try piloting it now, it’s stuck on “initialising the experiment”. This is the same experiment re-uploaded (successfully) with a new name. How do I trouble-shoot? I looked up previous responses to such problems and I don’t understand how to proceed (e.g., I don’t know how to “debug the JS script”).

Many thanks!
AK

Have you got any imports?

Best wishes

Wakefield

yes, all the files are there.

I went through the crib sheet, but I don’t know what to do with this information. What do I need to check in my experiment specifically?
AK

We can start with a few basics.

  1. Does your experiment have any code components? That is, in the builder, have you added any custom code? If so, are those components set to code type “auto->JS”? That’s where the document above comes in most handy, making sure that there’s nothing in your code components that won’t work in JS.
  2. When it gets stuck on “initializing the experiment”, you can open your browser’s JavaScript console to see what error it is producing. In Chrome, you can find this by going to View -> Developer, and it is similar in most other browsers (just look up “JS console” for your browser and you will find instructions). If you can copy the error message it will give a better sense of where to look.
  3. If you want more detailed help, you can link your experiment repository. For the experiment that isn’t working, on its Pavlovia page go to “view code” and post that link here. Make sure to make the repository public, which you can do on that page by going to settings -> general -> permissions.
  1. No, I have no code in the builder.

  2. When I run the experiment with the new name (as well as the experiment with the old name), the error is the following:
    Uncaught SyntaxError: Identifier ‘xys’ has already been declared

  3. https://gitlab.pavlovia.org/aek/memory_gp1

Thank you for looking into this!

I’ve just had a look at your JavaScript and your variable xys is being used to store the locations for several different items. I would recommend using a different variable name in each case (e.g. xys1, xys2, etc.)

I actually have no clue what variable xys is! It’s not a variable in the design. Is it a “variable” in JS? How do I go about changing it?

It seems you have multiple “mouse” components in the C1 trial type, and that looks like the root of the error. I’ll make a note of this for the developers, but it looks like the way PsychoJS stores mouse data, it can’t handle there being more than one mouse component in a single trial. Can you redesign your experiment so there is only one mouse component?

1 Like

I’m pretty sure that you shouldn’t have multiple mouse components in the same routine.

You have three in NativeProficiencyQuestion

ah, ok. I need to have participants click on one of three buttons in that routine. I’m sure there’s a way to do that with a single mouse click, but I don’t know how. I tried looking this up in existing demo experiments and I copied code from there that then I couldn’t debug. So I opted for three mouse components instead. This did work when I first piloted the experiment so I’m surprised it’s craashing now… In any case, how do I fix this to only have one mouse click?

You put all of the names of the buttons into the Clickable stimuli field, separated by commas.

Many thanks, that worked!
I have a different problem now, though. The experiment doesn’t load in all my pictures (error message: " unable to download resource: [picture name] Try to run the experiment again. If the error persists, contact the experiment designer"), so I’m going to try to resize the bigger ones. Another error message pops up when I close the window with the experiment but it stays on the screen for a tiny fraction of a second and disappears, so I have no idea what it said. Was something in PsychoPy updated/changed over the weekend…?

Check that all of your images are in your local html/resources folder. If not, copy them there and sync again.

yes, all the pictures are there, I promise!