| Reference | Downloads | Github

Between Subject Design experiment-Problem with Conditions

Hello Psychopy Community
I have a between subject design experiment. At the beginning of the Experiment i have a code to randomize the participant to a Group insert in a routine in “Begin Experiment”.
The code compenent calls Gruppe_2


import random
coinflip = random.randint(0,1)
if coinflip == 0:
assignedGroup = “Fotos.xlsx”
assignedGroup = “Fotos2.xlsx”

The two different Conditions, have two different exel files which are called: Fotos and Fotos2.

Here the participant should get a 0 or an 1 randomly, so the participant do the experiment A with the exel file fotos or the experiment B with the exel file Fotos2.

Next the 3 different Routines with loops are following, which have in Conditions $assignedGroups.

The Problem occures in Initial-Adaption routine. Which is the green Routine in the middle. Here it cant find the condition in the builder $adaptor.


“C:\Users\fisch\OneDrive\Desktop\psychopy\PsychoPy\”, line 112, in
image=adaptor, mask=None,
NameError: name ‘adaptor’ is not defined

Experiment ended.

The Second Problem is, that the code component doesnt work and in the Conditions it says No parameters found.

Without the Between Subjekt design, the experiment worked very well.

Im very new to Psychopy.
I am very thankful for your answers!
Kind regards,


you could add a

print("Group: ", assignedGroup)
print("coinflip: ", coinflip)

to your code-element to check whether your assignment works as intended and delete it afterwards if everything is ok.

The error message tells you that PsychoPy can’t find the image named “adaptor”. You need to check whether you have such image-file. Please also check the file-extension which seems to be missing.

You don’t need the code-line

import random

builder automatically imports this library.

Best wishes Jens

For the code-element i get the following error message:

Traceback (most recent call last):
File “C:\Users\fisch\OneDrive\Desktop\psychopy\PsychoPy\”, line 88, in
coinflip = random.randint(0,1)
AttributeError: ‘builtin_function_or_method’ object has no attribute ‘randint’

Experiment ended.

I deleted the code-line “import random” and added the
print("Group: ", assignedGroup)
print("coinflip: ", coinflip)

Its strange that the program cant find the adaptor, but it can find the other picture in the excel file. Because ist actually not an image but the name of the cell, where to find the correct image.

Thanks a lot for your fast anwser!


the print commands should only help you to determine what values the variables Group and coinflip have. The print command prints to stdout (where you see the error messages). What do the print commands print out?

coinflip = randint(1,3)

if coinflip == 1:
    assignedGroup = "Fotos.xlsx"
elif coinflip == 2:
    assignedGroup = "Fotos2.xlsx"

should assign the two different stimuli-files. You need to assign the file-names before you enter the loop in which the files are called.

Cells may not be empty AFAIK. I am not quite sure. Try adding something meaningful.

Best wishes Jens

Generating PsychoPy script…

Running: C:\Users\fisch\OneDrive\Desktop\psychopy\PsychoPy\

3922.2473 INFO Loaded monitor calibration from [‘2021_07_01 14:01’]
pygame 1.9.6
Hello from the pygame community. Contribute - pygame wiki
coinflip: 1
1.9385 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
6.7775 WARNING User requested fullscreen with size [1024 768], but screen is actually [2256, 1504]. Using actual size
9.8424 DEPRECATION ‘-1.0000, 1.0000, 1.0000’ is not a valid rgb color

Experiment ended.

It works! It changes between the two conditions with the different excel files ! Thank you very much!

I still dont know why the routine with one image doesn´t work.

Is there any meaning why it is green?
Or is it possible that only one image can’t be loaded over an excel file?


“it does not work” is insufficient as an error report. What does not work? What do you intend?

Best wishes Jens

Green routines have a known duration.

$adaption looks like it’s a variable but you’ve set it to constant. Is it set in Begin Experiment? If not then change this to Each Routine.

Oh thank you! i set it on every repeat and it works. But now there is a big break between the routines. The next routine isn`t starting after the routine with the $adaption.
I guess the other routines have 60 reps and the green Routine has only one picture and then it should end, but probably it does run aslong as 60 reps. Could that be the Problem?

I really appreciate all your help!
Kind regards,


well, you set the routine to last 60 seconds. Isn’t that what is happening?

Best wishes Jens

the picture lasts for 60 seconds and then there is a break and the other routine is not starting, but the experiment also doesnt end.
Kind regards,

Another question is, if I want to upload it to pavlovia, is there any code component that I have to add?

So just for anyone, who has the same Problem with a Break in-between the Experiment.
Apparently the problem was that every routine at the Experiment had 60 reps, but only the one routine had 1 rep, but the programm didnt recognised that so i had to limit the selected rows. IN my case was it the first so 0:1.
Very simple.