Error when opening long task Psychopy

I have a very long task flow, composed of 4 individual tasks (each task has different routines for instructions, showing images, offering feedback etc.). I worked on the task and closed it for a break. When I tried to open it again it wouldn’t open on double click (it showed the opening image of Psychopy, but just closed after a few seconds). I then tried to open a different, shorter task, and it opened ok. From that second task I tried File → Open and select the long task. It loaded for a while and afterwards I got this error message:

Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py”, line 727, in fileOpen
self.updateAllViews() # if frozen effect will be visible on thaw
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py”, line 972, in updateAllViews
self.flowPanel.draw()
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py”, line 3510, in draw
thisTerm = self.loops[thisLoop][‘term’]
KeyError: ‘term’

Do you know what caused it and how to solve it? It only happens when I try to open the large task.

This is how the flow looks when I try the File-> Open.

Thanks!

It sounds like your psyexp file is corrupt, but it could be fixable in a text editor. I would search for term. I’d be happy to take a look if you upload the psyexp file here. What version is it?

Hi! Thank you for the suggestion. I opened it with Notepad++ but I couldn’t find term independently, it was just included in the TerminateLoop. However, for confidentiality reasons I had to eliminate some routines and now when I open the file with psychopy it only shows an empty flow X_X. So, I guess I will have to do it all over again - hopefully things will not happen like this again.

It might be that you just need to re add your routines to your flow rather than start from scratch.

Do you have a very inefficient flow (multiple routines that are nearly identical rather than using loops)?

No, I couldn’t find the routines saved anymore. I actually have 4 different tasks, that I constructed separately, that I need to compile into one big flow, so that all data is saved in the same document. I have each task constructed in a different file and I just copied and pasted all flows into one big file. The routines are largely similar (i.e., they have to show certain pictures or instructions), but for some of the tasks I need certain keyboard responses and for others I need different keyboard responses. This is why I constructed different routines for different tasks, even if they were similar.

Do you mean that you did this in a text editor, in which case I’m not surprise it failed?

This thread might help

Personally, I would copy and paste each routine manually from one open Builder experiment to the next and then reconstruct the flow.

1 Like

I did what you said - I copied and pasted each individual routine in the builder, not in a text editor and then reconstructed the flow of each task one after the other and put each task in a different loop (I was going to randomize their order). Thank you for the applet - I will try it because I was worried I would have overlapping variable names and others.