Csv condition file (loop) with info from expInfo

Hi everyone,

Description of the problem: I am looking for a way to use the output of an Experiment Info within a csv file for conditions in a trial loop. My expInfo is “Gruppe” (group) that can have values from 1 to 8.

What I tried so far: I generated a total of 8 csv files that include different videos according to the group. The names of the csv files simply are:

  • group1.csv
  • group2.csv
  • group3.csv
  • group8.csv

In the conditions line within the loop it says: ‘group’ + str(expInfo[‘Gruppe’]) + ‘.csv’

However, I always get an error that the conditions file cannot be found but I don’t know whats the matter… I first tried it without the str(), but it didn’t work either. I just thought it makes more sense this way, since my groups are defined as numbers from 1 to 8.

Thanks in advance for your help!

Hello elani,

are you taking about an on-line or off-line experiment?

Best wishes Jens

Hi JensBoelte,

it needs to run online, but I only tried it within the builder so far.
Regards

Hello Elani

did you precede your expression with a $ try $'group' + str(expInfo['Gruppe']) + '.csv'? The str is not needed.

Best wishes Jens

Hi Jens,

with a $ it is working! Thank you so much! I didn’t think about a $, because I thought it only needs to be used with variables that are, e.g., in a csv sheet! But that’s great,thanks for the quick response!
Have a great day!

Hi Jens,

while your solution works perfektly within the builder, I have a problem when I try to synchronize it with Pavlovia…

I get the following error:
Traceback (most recent call last):
File “c:\users\eplog\anaconda3\lib\site-packages\psychopy\experiment_experiment.py”, line 829, in findPathsInFile
filePath = eval(filePath)
File “”, line 1, in
NameError: name ‘expInfo’ is not defined

As soon as I remove the conditions line ($‘group’+expInfo[‘Gruppe’]+’.csv’), the synchronization works again… Do you have an idea what to do about it?

Thanks again for your help!
Elani

Hello

did you add the *.csv under Experiment Settings - Online - additional resources?

Best wishes Jens

BTW. it is better to start a new topic when a new issue arises.

I started a new topic with this issue now :slight_smile: Sorry about that!