TypeError: Cannot read property 'clearEvents' of undefined*

URL of experiment: https://run.pavlovia.org/Aryanestevens/pierce-19a-dec-2020

Description of the problem: Hi there! I am a complete novice when it comes to any kind of coding, so please bear with me. My experiment is crashing at a certain point and I’m not sure how to proceed. This is the error message I’m receiving:

  • TypeError: Cannot read property ‘clearEvents’ of undefined

I’ve tried editing the JavaScript portion of the code to read “psychoJS.eventManager” (instead of “events.”), to no avail. The part of the experiment where things are going wrong is a section where I’ve added code in order to allow participant responses to appear on screen (the code for which I found by scouring the forum). I have also reviewed the PsychoPy crib sheet and I suspect that the solution may be there, but I can’t be sure. Any ideas? Thanks in advance :slight_smile:

Hey! I’ve got a general suggestion: to get a better grasp on what’s going wrong it could be useful to learn a couple of debugging tricks. This experiment contains links to tutorials about error handling and writing debug output: Thomas Pronk / assignment_stroop · GitLab

1 Like

Awesome, thank you! I will check this out.

1 Like

I’m having the same issue. Was there ever a solution found?

Please could you show the code where you clear events?

You are trying to clear events from a keyboard response that hasn’t yet started. Have a look at my crib sheet for how to write clear events. I think it’s just event.clearEvents() with event properly defined in code_JS

I’m sorry, I’m very new to PsychoPy and I’m not a coder. I’m also now on a time crunch to get my experiment up and running. Would be able to provide more simplified instructions by chance? Also, when I had it as “event.clearEvents” it gave me an error for that as well where its said it was undefined. It was working great for a few days then a made one minor time change and it’s popping up with this error.

I’m now on my laptop so I can check my crib sheet

Add event=psychoJS.eventManager; to a Begin Experiment tab of a JS only code component

Then event.clearEvents() should work.

1 Like

That worked great! Thank you so much!

1 Like