Description of the problem:
I am new to Psychopy and trying to run a simple stroop task variant online.
The experiment consists of a trial run with 18 stimuli and the actual experiment, in which 40 stimuli are supposed to be selected from a list of 160 conditions defined in an excel file. To achieve this, I wrote the command “$random(40)*159” in the selected rows field of the loop dialogue in the builder.
This command is the only difference between the trial run and the actual experiment and it works perfectly when run offline.
When piloting the study through pavlovia though, the trial is completed just fine, but when the actual experiment is supposed to start, the following error message appears:
Unfortunately we encountered the following error:
when importing condition: stim_ger.xlsx
when selecting entries from an array
unknown selection type: number
Try to run the experiment again. If the error persists, contact the experiment designer.
If I remove the command, the study runs perfectly fine again, but of course includes all 160 stimuli, which is not the purpose of the experiment.
I really hope that someone is able to help me with this. I have no experience with python whatsoever, but it is really important to get this study running online, because we cannot use lab-testing due to corona virus.
Many thanks in advance! Kind regards and stay healthy everyone!
Hi,
as I understand you have added a code in your “offline” version. Codes are not working online of what I am aware and that’s why you probably get this error message.
I’m having the same problem also. I was trying to select a subset of trials to run for each block. I was importing a csv file where all trials from all blocks are defined. I put my variable “$block_slice” (e.g., “0:20”) to denote the trial range to select at the beginning of each block. It works fine with standalone but shows the exact same error message when piloting on Pavlovia.
Update: using .xlsx as the conditions file instead of .csv seems to fix the problem. Have no idea why…
I was getting the same ‘unknown selection type: number’ issue when trying to select just 50 rows from a .csv (or .xlsx) with 10000 rows.
To fix this I removed “$random(40)*159” from the selected rows field entirely, so instead the loop presented all 10000 rows in a random order. In the routine that was being looped through, I added a code component and included the following code in the End Routine tab (my loop is called ‘trials’):
if trials.thisN==49:
trials.finished=True
This worked for my purposes; the loop would randomly sample from all 10000 rows from the .csv until it has presented every row, but now the loop will terminate early once it has passed through the loop 50 times.
I am running into the same issue when I run my experiment in Pilot mode on Pavlovia, which is working smoothly in Builder:
Unfortunately we encountered the following error:
when importing condition: Group_Conditions_2.xlsx
when selecting entries from an array
unknown selection type: number
I tried it as both a .csv and .xlsx and they prompt the same response!
This conditions file has just two conditions, which populate the rest of the experiment with different instruction texts. There is a second loop nested in this first one with a different conditions file that runs the trials, and I am wondering if having two conditions files is part of the issue.
I had numbers (1, 2) embedded in string column headers. I just removed those and replaced with text, but the problem is persisting. This is how the spreadsheet looks now: