Online Study .pop error

URL of experiment: https://gitlab.pavlovia.org/jfeiler/m-tone.git

Description of the problem: My experiment ran fine on Builder off-line. After uploading to Pavlovia, I keep getting the following error:

TypeError: undefined is not an object (evaluating 'tones.pop')

I’m really not sure how to fix this. The code it is referring to is found in one of the custom code components. The .pop command is used several times throughout my experiment, so I’m assuming this issue will occur again after fixing the tones.pop. Any help would be greatly appreciated.

I assume the issue is because either “tones” is not an object/array or the array can not be accessed from the code component.

I’d recommend adding this to the “begin experiment” tab for each code component you try to access the array called “tones”

tones = []

Hi There,

Another possibility is that if you are trying to use the python “pop” function this does not translate to JS - the solution for this would to replace with shift() - seethis crib sheet PsychoPy Python to Javascript crib sheet

Thanks,
Becca

For the moment, this seemed to have worked. I got a new error about * ReferenceError: Can’t find variable: thisExp but I’m replacing that withpsychoJS.experiment. Thanks @Becca for the resource and @Tamer_Gezici.

Now I’m getting * TypeError: undefined is not an object (evaluating ‘this._size[0]’). I can’t find anything about that on the crib sheet (or where that even is in my code). Any ideas here??

Run the experiment, do CTRL+SHIFT+J and look at the error log when the error is thrown. There will be a list of .js files on the console, next to the error. Click the one named with your experiment name. It will show which line in particular is throwing the error.

1 Like

@Tamer_Gezici ok i did that. I got this on the console when the error occurred:


There are several places in my experiment where I have the size of images and audio as “undefined”. Would that have anything to do with it? I left some fields blank in the component settings on the Builder.

It could be so yes, right now looking at the screenshot, I can’t tell what the issue is.

I think you are hitting the following issue in psychoJS: https://github.com/psychopy/psychojs/issues/176

I’ve asked in another thread how to get an updated version of psychoJS or how to workaround: How to get updated versions of psychoJS library?