Issue with Pavlovia Vs Psychopy

If this template helps then use it. If not then just delete and start from scratch.

OS (Win10):
PsychoPy version (PsychoPy 2020.2.10):
Standard Standalone? (y) :
**What are you trying to achieve?:running the experiment in Pavlovia does not work, Although works perfectly in psychopy builder.

What did you try to make it work?:

I have my experiment running perfectly, thanks to @wakecarter, (after a bit of pain and suffering) in psychopy in my laptop. When I sync the experiment and try to run it in pavlovia… the first set of loops seem not to be working properly. The weird thing is that their is not error anywhere.

Experiment link:

The experiment consist of 4 routines.
Each routine have different circles that need to be click by a mouse.
Each routine gets picked at random and runs for 60 seconds, then a set of instructions appear for ten seconds and a new routing gets picked up. This process gets repeated 16 times.
The outer “control” loop, controls the 16 times iteration, with and excel parameter sheet that controls the random picking of the routines. The sixty seconds loop, controls the 60 sec duration of each routine.
Everything works greate when I run it in my laptop: a routine gets picked at random, runs for 60 sec, then the instructions appear for 10 sec and another routine gets picked and process repeats it self 16th times.
The issue in pavlovia is that the first routine that gets picked, stays forever. It seems that the 60 sec condition never kicks in.


What code are you using to end Sixtysec after sixty seconds? I’m surprised not to see a routine after VariationThree to check whether 60 seconds is up.

Thanks again @wakecarter !!
every variation contains this piece of code:

Routine Var1Comp—>Code component:
Begin Routine:
if Sixtysec.thisN == 0: # only on the first iteration,
loop_timer = core.Clock() # start a new timer

Each Frame:
if loop_timer.getTime() >= 60.0:
continueRoutine = False
Sixtysec.finished = True

Have a look at my crib sheet.

core.Clock needs to be translated manually.

.thisN no longer works online

I would recommend adding a routine with a code component just before the sixtyseconds loop starts with a both code defining the clock in Begin Experiment and an auto code component which resets the clock in Begin Routine.

I’d put your Each Frame code in every routine inside the loops.

Best wishes,


Hi @wakecarter, I don’t understand what you mean here “core.Clock needs to be translated manually.”
Also, if thisN does not work online, I could have a Idx == 0 variable declared at the beginning of routine and then use this variable in the—> if Idx=0 then loop_timer = core.Clock()
What do you think??

That might work.

Have you looked at my crib sheet (see pinned post in the online category)?

ok I got all of that.
I have created a routine just before the sixtysec loop that defines the core.clock at the begining of the experiment with the manual translation to util.clock and also resets the clock:

and at the Begin Routine I reset the clock:

Then in each variation frame I have:

Al this looks like it works but, after the first iteration of the sixtysec loop the 10sec instruction come on (all good up to here), but instead of staying for 10 sec, the instructions stay forever.

Any Ideas

If your routine is before the sixtyseconds loop starts then you can just loop_timer.reset() in Begin Routine without worrying about Idx.

Alternatively, you need to add 1 to Idx after the loop times has been reset and then set it back to zero after sixty seconds is up.

maybe I am missing something, when the sixtysec loop gets terminated because it met the 60 sec condition, the 10 sec instruction routine kicks in. The instruction routing should stay for 10sec as specified in the “duration” under the text properties. This does not happen, it stays forever…
After the instructions the control loop should run (the control loop runs for 16 reps) and kick start the process again.
Still the issue I am having is the instructions not ending after the duration of 10sec.
Really weird!!!
I changed the location of the instruction routine to be before the sixtysec loop and before the routine where I declared the time_loop.
So the instruction routine is the first thing that is encounter. The instruction routine seems to work fine on the first iteration but after the time_loop get reset and the 60sec gets fulfill, the Instruction routine gets Triger on the second iteration and then stays forever. So it seems that the issue is after the time gets reset.
Can you take a look … you certainly know more then me. Thanks in advance!

If the issue is that the instruction routine isn’t ending, please could you show it’s contents? How are you ending it immediately on the first run and then switching to 10 seconds?

sorry @wakecarter, here you go
I started to thing that the issue may be in the sync from psychopy to pavlovia. This experiment has issues “only online”, when I run this locally, runs perfectly.

Is there anything else in the routine? So long as your units aren’t pixels I can’t see of anything that might cause an issue there.

No pixels, I have cm.
I have included a diagram that explain the process, let me know if see anything wrong that would not work online:

I don’t think cm works online.

A text height of 0.03 cm doesn’t sound good either (0.3mm)

I recommend only using height or norm units online. I usually use height as default and norm for text components.

Good to know I will make the change, but if you look at my diagram, the first time that the instructions come up in the flow, works fine, 10 sec and the routine terminates. In the second iteration or rep is when things go funcky, the routine stays forever. Could be that resetting the core.clock throughs the timing of the instruction routing off??

I can’t see a * in the Begin Routine tab of the ClockReset code component to suggest that you have any clock reset code.

What would be the behaviour if the clock didn’t reset?

sorry forgot this in the Begin routing:

It’s a Both routine so there’s no automatic translation.

OK so I have made the suggested changes and they look like this: on Clockreset routine just before the sixtysec loop
is this correct?
I just synced the experiment and run it and still the same issue.
I also have reloaded the experiment to pavlovia (fresh start) here is the link (public):

ok Mr @wakecarter, you got it. I did exactly what you suggested and it work great!!!
one comment though in one routine you cant have different code types, I got around it by adding another code component. Also straggling with code types and alternative ways to solve the shortcomings of online vs local psychopy, I came to learn the differences in code types and there inner workings.

Thanks a lot for your help!!!

1 Like