continueRoutine = False in Begin Routine tab has no effect

OS: macOS
PsychoPy version: 3.2.3
Standard Standalone?: y
What are you trying to achieve?: stop a routine from being run

I tried to stop a routine from being run by putting continueRoutine = False in the Begin Routine tab of a code component (and placing this component at the top of the routine). However, this setting is overwritten once the code is generated and thus has no effect:

# ------Prepare to start Routine "trial"-------
# update component parameters for each repeat
continueRoutine = False
# (...)
continueRoutine = True

This seems similar to the issue described here.

Jan

1 Like

That’s an ancient old issue: can’t understand how it has raised its head again if you are using version 3.2.3. Are you able to post your .psyexp file here?

Thanks for your quick response, @Michael. Here you go.

test.psyexp (7.1 KB)

Oh wow, this is bizarre. Can replicate that in 3.2.3 with other files too. Not sure how this hasn’t been causing problems for other people too.

Will need to call on @jon and @dvbridges for this one, as it is due to how Builder generates the .py file, which is not a part of the code base I am very comfortable with.

Jon: looks like there has been some sort of regression to this issue, which you addressed back in 2016:

As noted, not sure how this isn’t causing all sorts of grief to people, as setting continueRoutine = False is such a common technique. Have there been any recent changes that could have impacted this?

Looking further into this, by setting “Use Psychopy version” in the experiment settings, the behaviour was correct up until version 3.1.5, and then from 3.2.0 onwards, the old behaviour re-emerged, of resetting continueRoutine to True immediately before the routine begins.

So Jan, as a short-term workaround you could tell Builder to use version 3.1.5 in the “Experiment settings” of your file (assuming that doesn’t cause issues with some other things that have changed recently, including the improved timing that came with version 3.2.0).

The first time you do this, there may be a slight delay, as PsychoPy will be downloading some of its 3.1.5 code in the background as required.

For us, the offending line in the repository is here:

2 Likes

Thanks for looking into this further and the suggested workaround, Michael.

Jan

I had the same problem on a windows machine. Your workaround worked for me as well. Thanks!

For future reference, there is a pull request that should address this issue here:

so I am hoping this problem should be resolved in the next release (3.2.5), which should return to the expected behaviour.

1 Like

@Michael
I’m trying to overcome the same bug (I got stuck on chapter 0.7 of Jon’s book)
using your short-term workaround

Psychopy builder standalone v3.2.4
Windows 10.

When I try to select builder version 3.1.5, the UI doesn’t give me that option or a place to enter code.
psychopy version select
Is it expected to update the XML of the .psyexp file?

<?xml version="1.0" ?>
<PsychoPy2experiment encoding="utf-8" version="3.2.4">

to

<?xml version="1.0" ?>
<PsychoPy2experiment encoding="utf-8" version="3.1.5">

I tried this and the experiment starts and appears to hang with an empty grey screen.

Hi @frankbolton, if you are using a code component to end the routine on a particular condtion, then you need to move the continueRoutine = False command to the “Each Frame” tab.

1 Like

@dvbridges thanks for the workaround! Sorted me out.

No problem, btw this will be fixed in the next release and you can revert back to the method recommended in the book.

1 Like