psychopy.org | Reference | Downloads | Github

Experiment crashes online due to a "no response"

Hi everyone,

When running the experiment online on Pavlovia it is not accepting a “no response”, it crashes with the following error:
“TypeError: Cannot read property ‘length’ of undefined”
This doesn’t happen when running the experiment via the builder (this routine has a time limit and should end also without a response).

Any ideas?

Thank you!

Have you used any of your own code (e.g. a code component in this study)? Maybe you could provide a link for us to check what’s gone wrong. But basically somewhere in the experiment the code is checking for the length of keys before first checking whether keys is anything at all

Hi @jon,

I have recently encounter the same problem. In my case, I used a code component to change the opacity of a polygon according to whether or not a response is made, so my code is in fact checking for the length of keys… it works in builder, but I don’t know how to fix this online. I’d appreciate your help.

Here is the link to the experiment: https://pavlovia.org/run/laurapissani/sachs-awakening_cmlp/html/

Screen Shot 2020-07-16 at 7.36.13 AM

Try

keys=event.getKeys()
if len(keys):
     test_visibility=0

For event to auto translate you need to define it in code_JS as per my crib sheet.

oh thank youu, should I put that in begin routine tab or right above the other code in the each frame tab?

oh I think you mean instead!

1 Like

@wakecarter

I changed the code and now there is no error but the code seems not to be working (the polygon doesn’t appear and disappear according to response). Do I have to customize something? (I did translate ‘event’ using your crib sheet).

I avoid having any components with “Each Frame” updates. Instead I use code to make the changes. You could replace test_visibility=0 with polygon_1.setOpacity(0)

Thanks so much for following up @wakecarter

OK, I changed that and it seems to be almost working, except it seems now that the polygon is not fully opaque at the beginning of the trial cause I can see the text the polygon was supposed to cover. Should I add anything in the beginning routine tab? something to make the polygon_1 start fully opaque?

What I have now is a variable call text_visibility which is =1 in the begin routine tab, and the that variable is in the opacity field of the polygon component.

Screen Shot 2020-07-16 at 2.02.22 PM Screen Shot 2020-07-16 at 2.02.17 PM

When you make a change to a visual object I think it moves to the front. I think you can then move something else in front using .setAutoDraw(True)

In the component set opacity to 1 constant

Thanks for keep helping me @wakecarter, I am sorry but I am not sure how to use .setAutoDraw(True), should I put it in the begin routine tab like this?

polygon_2.setAutoDraw(True)

Screen Shot 2020-07-17 at 10.50.06 PM

This is what I have so far, but it is working terrible :frowning: now I can’t even see the polygon.