psychopy.org | Reference | Downloads | Github

Unable to load and run saved experiment

Hello, I am very new to PsychoPy and coding in general, hence I rely a lot on the Builder aspect. I have made an experiment using the Builder component only, and was able to run it with no problems before I save it to my experiment file and close PsychoPy.

However, after I close PsychoPy and open my saved experiment again, it does not load. The flow view indicates no trial whatsover. This is what the situation it looks like:


Running the experiment is also unsuccessful.

I have restarted my computer, and reinstalled PsychoPy as well, but I still get the same error. Below are some details:

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 1.84.1
Standard Standalone? (y/n) : Y
What are you trying to achieve?: Loading and running my experiment

What specifically went wrong when you tried that?:

This is the error message I got:

Failed to load C:\Users\user\Desktop\Time Judgment Task\ordinal_comparison_fullAB.psyexp. Please send the following to the PsychoPy user list
Traceback (most recent call last):
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.1-py2.7.egg\psychopy\app\builder\builder.py”, line 1473, in fileOpen
self.exp.loadFromXML(filename)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.1-py2.7.egg\psychopy\app\builder\experiment.py”, line 596, in loadFromXML
self.flow.append(self.routines[elementNode.get(‘name’)])
KeyError: ‘trial’

Somehow you’ve managed to delete the Routine called ‘trial’ but it remained on the Flow. Any idea what you did leading up to this? (PsychoPy shouldn’t allow that to be possible).

We can fix it by opening the .psyexp file in a text editor rather than in PsychoPy. There will be a line towards the end of the file adding the trial routine into the flow and that needs deleting. Make a copy of the file first, in case you really mess it up, and/or upload a copy to this thread for us to help fix it.

Hi Jon,

Thank you very much for the reply.

I did delete the routine called ‘trial’ that appears whenever you open a new experiment. Then, I inserted new trials and loops that make up my experiment.

I followed what you advised and removed the flow part which you mentioned needs deleting. However, I still face the same problem.

Here’s a copy of the file:
ordinal_comparison_full.psyexp (48.0 KB)

Hi Salwa,

I went through the same a while ago and the best thing you can do, if you have enough time and the flow is not that long, is to create a new file and start fresh BUT without deleting the default trial at the beginning.

I opened your file and I got the same message even when running the experiment in the coder.

Best,

Marcos

In your case there was an issue with “trial” but also an issue finding “StimA” which I think you might have renamed to “FaceA”? The file below appears to open and load the Flow correctly but check the routines are the right ones.

ordinal_comparison_full.psyexp (47.9 KB)

For more information on the issue that caused this see:

Hi Jon,
The file seems to open and load correctly now with the right routines.
Yes, I think I had renamed some routines, so that is most likely what is causing the problem.

I really appreciate your help in this, thank you!