OS: Windows 10, version 20H2, OS build: 19042.1237
PsychoPy version 2021.2.3
Hello. I have been creating a picture naming experiment with the psychopy builder and have been using the the <\ > Code component to add functionality that is not default in builder. The flow of the experiment is as follows:
The Stim_loader includes the following custom code.
begin experiment
#Create empty lists
pnt_list = []
random_list = []
**Begin routine **
#save each word as the loop iterates
pnt_list.append(pnt_items)
random_list.append(random)
The loader_loop loads the condition file necessary for the experiment which contains 175 conditions with 2 parameters: stim_images and Block. Stim_images contains the file locations for the 175 pictures to be used in the experiment. Block can be ignored.
In the word shuffle routine i randomize the 175 images into two lists to be administered before and after the break routine. Within this routine there is one code block that I have labeled codeShuffler Within the Begin routine section I have the following code:
#Shuffle stimuli list
shuffle(pnt_list)
shuffle(random)
pnt_list1 = pnt_list[0:87]
pnt_list2 = pnt_list[87:175]
print(pnt_list2)
The following routines run fine after this: Main, PNT_instructions, Practice_items, end_practice, PNT_1, and Break and the error arises when I include PNT_2 in the experiment. PNT_1 and PNT_2 are formatted nearly identically. The functional PNT_1 contains, code, image, and a keyboard component. Within the code componenet I have the following:
Begin Experiment
#Item counter
curr_item = -1
Begin Routine
#increment item counter by 1
#starting at negative 1 makes python chose first item with the beload code
curr_item += 1
#update the item variables as we progress through list
word = pnt_list1[curr_item]
random = random_list[curr_item]
To call the images within the image component I input $word and “set every repeat”.
The PNT_2 routine contains identical code but with slightly different labels.
Begin Experiment
#Item counter
curr_item = -1
Begin Routine
#increment item counter by 1
#starting at negative 1 makes python chose first item with the below code
curr_item += 1
#update the item variables as we progress through list
word2 = pnt_list2[curr_item]
random = random_list[curr_item]
When I run the experiment without the PNT_2 routine it runs without errors. When I run the experiment with PNT_2 I get the following error:
Traceback (most recent call last):
File "C:\Users\alexa\OneDrive\Documents\GitHub\PNT-CAT\AnomiaR01\PNT_beta\PNT_with_break_lastrun.py", line 172, in <module>
image=word2, mask=None,
One secondary question The output file I create with this experiment does not include the stimulus name (image_PNT)**
It is not clear to me what or where I should add the code to make sure the output file also contains the stimulus name, not just the response.
Thanks in advance for any help. This is my firs ttime posting here, so apologies if I do not format totally correct!