Psychopy stuck when trying to select video from list

Hello,

I am trying to build a very simple experiment with 4 categories of small mp4 videos. For each category there are 10 numbers and for each number there are 25 examples so in total I have 1000 stimuli.
When I try to play single sitmuli it works but when I try to create lists it just get stuck and does not continue. I have tried both with a code and both with just creating two excel files. Here is my code. I already added some debugging and everyhting seems to be defined well. It gives no error it just takes long to start and then it crushes. Any clue ?

HOW I CREATE LISTS an example:

Blockquote for i in range(1):
Twelve_HB = [f’12_hu_bio_{j}.mp4’ for j in range(1, 26)]
shuffle(Twelve_HB)

HOW I DEFINE THE NUMBER TO BE SELECTED:

Blockquote if NUMBER1 == ‘twelve_bio_hu’:
if not Twelve_HB:
Twelve_HB = [f’12_hu_bio_{j}.mp4’ for j in range(1, 26)]
number_1 = Twelve_HB.pop()
elif NUMBER1 == ‘eighteen_bio_hu’:
if not Eighteen_HB:
Eighteen_HB = [f’18_hu_bio_{j}.mp4’ for j in range(1, 26)]
number_1 = Eighteen_HB.pop()
elif NUMBER1 == ‘forteen_bio_hu’:
if not Fourteen_HB:
Fourteen_HB = [f’14_hu_bio_{j}.mp4’ for j in range(1,26)]
number_1 = Fourteen_HB.pop()
elif NUMBER1 == ‘eight_bio_hu’:
if not Eight_HB:
Eight_HB = [f’08_hu_bio_{j}.mp4’ for j in range(1, 26)]
number_1 = Eight_HB.pop()
elif NUMBER1 == ‘fifthteen_bio_hu’:
if not Fifteen_HB:
Fifteen_HB = [f’15_hu_bio_{j}.mp4’ for j in range(1, 26)]
number_1 = Fifteen_HB.pop()
elif NUMBER1 == ‘twenty_bio_hu’:
if not Twenty_HB:
Twenty_HB = [f’20_hu_bio_{j}.mp4’ for j in range(1, 26)]
number_1 = Twenty_HB.pop()
elif NUMBER1 == ‘twenty_one_bio_hu’:
if not Twentyone_HB:
Twentyone_HB = [f’21_hu_bio_{j}.mp4’ for j in range(1, 26)]
number_1 = Twentyone_HB.pop()

I already added print(number_1) & print(number_2) and it works fine. Any suggestion would be super helpful!! Thanks in advance

My best regards
Ana

Hi Ana,

Your code also works fine for me when I try it below, so it must be something with how that value is used in the movie - could you please share how you are making your movie?

If it were me this is the approach that I would take.

The code that you have would be a code snippet in Builder. I would then have a movie component in my Builder routine and teh movie path field would be $number_1 with that field set to “set every repeat. If you have a static component (e.g. a fixation period before your movie” you might also use “set in ISI” rather than “set every repeat” so that the movie loads in the static period).

Hope this helps,
Becca

Hello Becca,

Thanks for the answer. This is exactly how I have it. I have $number_1 in the path for the movie. I have a loop around the routine with an exel file that defines the condition and then the code picks the video based on the conditions

I tried just using an excel file and also using the Static component to pre-load the videos and it works. In order to make the preloading work also with the codes do you think i need to specify in a different way ? Cause i tried with the static and the code and it is the same proble, it freezes.

thanks a lot !
Ana