The experiment won't start at all when add one more routine

OS (e.g. Win10):
PsychoPy version (e.g. 1.84.x): PsychoPy3-2020.2.8-win64
Standard Standalone? (y/n) If not then what?:y
What are you trying to achieve?:
Hi! everyone! I’m here again with another question. it seems like that when I add one more routine (e.g., r4_recg2) in an loop, the experiment won’t start at all, and there is no Error report, all the message the “Experiment Runner” gave is
"##### Experiment ended. #####

Experiment ended. #####".

At first, I thought it might be something wrong with my code in the code component, so I check, no problem. then I delete an existing routine (e.g., r4_recg1), and add another routine (r4_recg2), the experiment can run again.

To be noticed, there are a lot of routines in my flow, and many routines have code components, and the code are very long, like hundres of lines. I’m wodering if there are some capacity limits of routines or line of codes in Psychopy.

I also made another try, I added 2 simple test routine which only have simple text components instead of the components which had like three hundred lines of code (e.g., r4_recg1 or r4_recg2), then the experiment also can work.

It’s very confusing to me, and I need to solve this problem as soon as possible. Looking forward to hearing from you soon. Thanks a lot! I appreaciate very much! :sparkling_heart: :sparkling_heart:

by the way, I just tried the experiment in MacPro(macOS Mojave version 10.14) Psychopy v2020.2.4. there is no such problem at all, the two rotuines can exist together and the experiment runs very well. So why it didn’t work in win10 PsychoPy3-2020.2.8-win64? :cry:

I also tried on win10 PsychoPy3-2020.2.4-win64, didn’t work either.

I tried another way, I cut this loop (the 4th run) from the existing flow to make it an independent experiment, then it works fine, so it seems like there is some capacity limit of psychopy, but I don’t know why because the manual of Psychopy says that the number of routine is unlimited.

I still hope the 4 runs can be in the same experiment instead of split them. So is there any good advice?

The most obvious reason why an experiment could run with either routine but not both is if they both define an object or function with the same name. PsychoPy should prevent components with the same name so it’s likely to be in the code components. Check the code components in both routines and make sure you look at every tab. I once had a similar issue because I’d accidentally left something in End Routine that I no longer needed.

P.S. Your experiment would be much improved if you reused routines (perferably in concentric loops) rather than having lots of almost identical routines.

Hi! Thank you so much for your quick reply :sparkling_heart: :heartpulse:. I check my code and component in these routines, but there is no components with the same name, and the same experiment can run well in Mac but cannot work in win10, maybe it’s not the problem of routine components?

Yeah, I see your point and I also tried to improve that way, but my programming ability is poor :cry: I cannot figure out how to reuse the same loop to complete different runs :sob:.

here is the message when I click RUN button, without any Error report, just the experiment end prompt, but this won’t happen in Mac. In Mac, the experiment just works perfectly fine.

Besides, the experiment cannot work not only when I add r4_recg2 routine, when I add other complex routines where the components has complex codes (like r4_rec7 or r4_rec8, which are the recall of the 7th and 8th pictures period), the experiment cannot work either, but the code is right because the logic and frame of the codes in different components is the same, I just need to modify the run index, so there is not a big chance for code to be wrong. Again, this won’t happen in Mac. But I need it to work in Win10, because the computer that MEG use to present stimuli to subjects is based on win10.