# How to select condition files depending on participant number

**URL:** <https://discourse.psychopy.org/t/how-to-select-condition-files-depending-on-participant-number/38496>\
**Category:** Builder\
**Created:** [February 3, 2024, 6:15pm UTC](https://discourse.psychopy.org/t/how-to-select-condition-files-depending-on-participant-number/38496 "2024-02-03T18:15:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gucciapplepie](https://avatars.discourse-cdn.com/v4/letter/g/5f9b8f/32.png) [@gucciapplepie](https://discourse.psychopy.org/u/gucciapplepie)\
**Post date:** [February 3, 2024, 6:15pm UTC](https://discourse.psychopy.org/t/how-to-select-condition-files-depending-on-participant-number/38496/1 "2024-02-03T18:15:47Z")

</div>

If this template helps then use it. If not then just delete and start from scratch.

**OS** (e.g. macOS 13.4.1):  
**PsychoPy version** (e.g. v2021.2.3):  
**Standard Standalone? (y/n)** If not then what?: yes

**What are you trying to achieve?:**  
In essence, I am trying to run an experiment where each participant (001-050 or so) has their own condition file. This experiment was originally done with each participant utilizing the same condition file, but I have decided to give each one their own. I have each condition file made, however I just have no idea how to even get started.

**What did you try to make it work?:**  
I have tried adding

ID=expInfo[‘participant’]

To the beginning of the first routine, along with using “$CondFiles/ID\_blockgen.csv” as the condition for its corresponding loop.

**What specifically went wrong when you tried that?:**

NameError: name ‘CondFiles’ is not defined,

I have no idea how to even go about defining the term for it to fill in to understand each condition file for each participant.

Please help!

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [February 3, 2024, 7:00pm UTC](https://discourse.psychopy.org/t/how-to-select-condition-files-depending-on-participant-number/38496/2 "2024-02-03T19:00:31Z")

</div>

> [@gucciapplepie](#):
>
> $CondFiles/ID\_blockgen.csv

```auto
$'CondFiles/' + ID + '_blockgen.csv'

```

---

<div class="post-metadata">

**Author:** ![gucciapplepie](https://avatars.discourse-cdn.com/v4/letter/g/5f9b8f/32.png) [@gucciapplepie](https://discourse.psychopy.org/u/gucciapplepie)\
**Post date:** [February 3, 2024, 8:10pm UTC](https://discourse.psychopy.org/t/how-to-select-condition-files-depending-on-participant-number/38496/3 "2024-02-03T20:10:35Z")

</div>

Thank you, that helped out for the computer understanding what it was looking for. But then it gave this error:

“/Users/myname/Desktop/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/data/utils.py”, line 300, in importConditions  
raise ValueError(msg % os.path.abspath(fileName))  
ValueError: Conditions file not found: /Users/myname/Desktop/Psychopy\_NegPosNeuDemo\_DenisUpdated Practice Run/001\_Condfile\_run1part1.csv

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [February 3, 2024, 8:24pm UTC](https://discourse.psychopy.org/t/how-to-select-condition-files-depending-on-participant-number/38496/4 "2024-02-03T20:24:22Z")

</div>

I wouldn’t recommend running experiments from your desktop.

You file name in the error seems to be a very long file name straight on your desktop without a subfolder. The subfolder isn’t needed but you seemed to have on CondFiles in your original example.

---

<div class="post-metadata">

**Author:** ![gucciapplepie](https://avatars.discourse-cdn.com/v4/letter/g/5f9b8f/32.png) [@gucciapplepie](https://discourse.psychopy.org/u/gucciapplepie)\
**Post date:** [February 5, 2024, 9:30pm UTC](https://discourse.psychopy.org/t/how-to-select-condition-files-depending-on-participant-number/38496/5 "2024-02-05T21:30:30Z")

</div>

I’m confused on what you mean? I have typically only run experiments on my desktop and they have ended up okay.

---

<div class="post-metadata">

**Author:** ![gucciapplepie](https://avatars.discourse-cdn.com/v4/letter/g/5f9b8f/32.png) [@gucciapplepie](https://discourse.psychopy.org/u/gucciapplepie)\
**Post date:** [February 5, 2024, 9:31pm UTC](https://discourse.psychopy.org/t/how-to-select-condition-files-depending-on-participant-number/38496/6 "2024-02-05T21:31:05Z")

</div>

Apologies for so many replies, I have only been working with psychopy/working with any programs in the last few months and am still quite a beginner at it.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [February 6, 2024, 9:42am UTC](https://discourse.psychopy.org/t/how-to-select-condition-files-depending-on-participant-number/38496/7 "2024-02-06T09:42:45Z")

</div>

I mean that you should save the files in the documents areas of your computer and not the desktop area.
