TypeError: Cannot read property '_gui' of undefined

URL of experiment:
https://pavlovia.org/kito323/circle

Description of the problem:
Hello!
My problem is similar to the many before mine. When I run my experiment locally on PsychoPy it works fine. But when I upload it to the Pavlovia I get errors. Previously I’ve seen that this error occurs due to positioning problems. Usually the answer was that when reading locations in from excel/CSV file the x and y coordinates should be separately. In my case I use custom code component to create those positions. Idea is to have 10 circles flying and bouncing around the screen for about 10 seconds. I define initial positions and velocity vectors for the dots in the code component. Right now for the simplicity the paths are predetermined because I can’t use external libraries like numpy to generate randomness due to auto->JS option that is needed to run it online (it was previous error that the ‘np’ was undefined). When I look browser console when this error occurs I see this:
browser_console|690x359
On my main js file (circle.js) on the line 443 there is “correct_dot.setSize([dot_size, dot_size]);” what seems pretty okay to me as the variable ‘dot_size’ is defined previously (then again I looked at JS first time during this project). I tried moving around the defining of that variable in my code component and tried setting the size variable constant/non-constant in the builder but it didn’t do anything (only threw warning when tried to set it constant that I might want to set it to update but actually, de facto, I don’t).
I tried messing around with the positioning of the dots in builder as well but it didn’t seem to work either. Everything always gave me the same error message.
I guess the experiment should be accessible so the code component and dots’ settings in builder can be seen there.
I guess if none of it works I can pre generate and choose the random paths with python and numpy and save them in a csv file and then read it in with the loop and get rid of the code component entirely and then it should definitely be able to run online, right? Because it feels like that the problem is due to my code component and the variables defined in there. Though it seems to me a bit dumb way to do it.
(A bit off-topic but should I somehow use framerate variable too to be sure that everyone get the same dot speeds? How should it be done then with the pre generated paths?)

Thanks in advance!

Hi there,

’ When I run my experiment locally on PsychoPy it works fine. But when I upload it to the Pavlovia I get errors.’ - this means that this is a JS translation error (because the local, python, code runs fine - the psychopy to JS crib sheet can help greatly with these types of error - https://docs.google.com/document/d/13jp0QAqQeFlYSjeZS0fDInvgaDzBXjGQNe4VNKbbNHQ/edit#heading=h.niu1u15qj037)

'Right now for the simplicity the paths are predetermined because I can’t use external libraries like numpy to generate randomness due to auto->JS option that is needed to run it online (it was previous error that the ‘np’ was undefined). ’ - you can replace np.random with Math.random on the JS side of your code component(see the crib sheet for this too :slight_smile:) .

So that we can se your code components and help out, please can you share the project files with us by sharing the URL of the gitlab page (accessible via View code) - the project visibility will need to be public for us to view.

Thanks,
Becca

Hi!

I thought that from the experiment page (which was the first url at the start of my post) clicking on the ‘View code’ button anyone can access the project files (because I could do it in incognito mode without logged in or anything). Anyway the gitlab repository is here: https://gitlab.pavlovia.org/kito323/circle.

I’ll look more deeply into the JS crib sheet later but isn’t it a bit inconvenient that to make your experiment work online you have to “hack” your way to it… :confused: Anyway, thank you for the link!

Hi There,

I think that if you move the code currently in the ‘Before Experiment’ tab to the ‘Begin Experiment’ tab that should resolve your ‘_gui’ error. Currently it is trying to execute that code before any imports have occurred.

Let us know how you get on,
Becca

PS. you are correct about the original URL - my apologies, I missed that.