psychopy.org | Reference | Downloads | Github

Stroop task with counterbalanced block

OS (e.g. Win10): MacOSX 10.14.5
PsychoPy version (e.g. 1.84.x): 3.1.0
Standard Standalone? (y/n) : yes
What are you trying to achieve?:
Execute the code from the book ‘Building Experiments in Psychopy’. Chapter 8.

What did you try to make it work?:

What specifically went wrong when you tried that?:
The variable ‘group’ is created and declare in the expInfo but I have the following error message:

 Running: /Users/marcusmissal/Desktop/Bureau_restaure/PsychoPy/onlineMaterials/2 - first experiment/stroop/stroop_lastrun.py 
2019-06-04 14:28:52.817 python[44197:3464832] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
Traceback (most recent call last):
  File "/Users/marcusmissal/Desktop/Bureau_restaure/PsychoPy/onlineMaterials/2 - first experiment/stroop/stroop_lastrun.py", line 187, in <module>
    trialList=data.importConditions('Group' + group + '.xlsx'),
NameError: name 'group' is not defined

Although group is defined. I tried what I could but can not figure it out…Thanks for your help.

Hello,

group doesn’t stand alone as a variable name, it becomes one of several entries in the expInfo dictionary, so you access it like this:

expInfo['group']

e.g.

'Group' +  expInfo['group'] + '.xlsx'

Lastly, I deleted your code. Please don’t post the entire script of your experiment: it is too long for anyone to read. If you need to share your experiment, please just post the .psyexp Builder file as an attachment, it is much easier to work with.

If you need to post specific bits of code (which is fine), please do this to make it readable (it preserves the indenting, which is important when reading Python code):

Thank you very much et sorry for the mess.
Marcus.