TypeError: unsupported operand type(s) for +: ‘Routine’ and ‘str’

Hello!

For quite awhile now, I have been attempting to troubleshoot a Stroop task experiment that I received from another lab. Eventually growing tired of constant bug fixes, and becoming convinced that the errors were due to incompatibilities with the computers, I re-created it entirely on the lab computer.

While this solved some issues, there is still a recurrent error message that looks like this:

TypeError: unsupported operand type(s) for +: ‘Routine’ and ‘str’

And this is the section in question from the builder:


(I apologize for the bad photo quality; this is the best I could do.)

I’ve seen similar errors on this forum, but so far, none of those fixes have worked. I understand it must not be pulling the text I need from the instructions excel file, but:

  • Recreating the instructions file made no difference (so there shouldn’t be any blank cells)
  • As you can see in the photo, it’s set to every repeat (so it’s not that it was set to constant)
  • Attempting to print variables ‘welcome’ and ‘contin’ gives me

NameError: name ‘var’ is not defined

I would greatly appreciate any help with this! I assume the fix must be something quite simple.

OS: Windows 10
PsychoPy version: 2024.2.1

Do you have a routine called welcome?

Yes, there is a welcome routine

Your error message is because you can’t have a variable which has the same name as a routine.

1 Like

Oh I see. That’s very strange since I recreated the experiment exactly from the original… I tried it on my own computer and I think it’s working. I’ll have to test on the lab computer on Monday to see if it fixes the issue there.

If this doesn’t fix the problem, is there anything else I can try? Thank you so much!

That depends on the new error message. The one in the title of this thread can only be fixed by not using the same name for two different things.

Hello! I got a chance to test it today and it resolved the error. I must say, I’m still confused as to how the experiment could’ve worked properly for the other lab with an error like this, but honestly I’m just glad it’s working. Thank you!