Loop properties syntax error when selecting rows

Hi. I’m using standalone PsychoPy version 3.0.0b9 in W10. I have a conditions file where rows 1 to 10 are for block 1, and rows 11 to 20 are for block 2 (if we ignore that the column names are in row 0). When defining my first block loop, I set ‘selected rows’: 0:10. This works, so I try a similar thing with block 2 but this time from 10:20 (or actually 10:-1) and then I get the ‘Python syntax error in field Selected Rows: 10:-1’.

I’m just a bit confused why this is happening, and haven’t seen an answer that has helped solve this. Just so it’s clear, the excel file itself has column headers in row 1, and stimuli from row 2 to 21, and I just want to present different blocks from subsets of the rows.

1 Like

Hmm, I can reproduce the problem with the attached minimal example on PsychoPy 1.90.2. Whenever I enter any range (x:y) in Selected rows, I get the Python syntax error in field Selected Rows as well.

conditions.xlsx (8.0 KB)
selected_rows.psyexp (4.2 KB)

Strange, with the example you posted @TorgeMS, it works fine for me if I enter either 0:5 or 10:-1 (using 3.0.0b6).

I did find that if I intentionally entered some junk in that field (like *&^#) then the red syntax error warning appeared and wouldn’t resolve unless I clicked “cancel” to close the dialog box. i.e. The content of the field could only be replaced with a valid expression by cancelling and then opening the dialog again.

Now it gets strange: I tried it again with my own example in 1.90.2. today and couldn’t reproduce the error anymore. It worked perfectly now and even if I entered junk in the field like @Michael, the red text wasn’t shown anymore, but instead the experiment was adequately cancelled with the error

for n in selection:
TypeError: 'NoneType' object is not iterable

Yesterday, I also had the resolving issue @Michael reported. The only thing I did differently yesterday was that I executed the experiment right after creating it and not after reopening it. So I recreated the same experiment again, and in fact, the original red error showed up again!

So @fffrost, have you tried reopening the experiment? Does the problem still persist?

Hi, it mysteriously works perfectly now. I did update my PsychoPy, but in the process also closed and reopened it. Maybe it was that.

Problem seems resolved.