PsychoPy Handling error - cannot use builder

Hi everyone,

I’m trying to use the latest version of PsychoPy. I’ve installed it via pip install in the Anaconda3 powershell.

I can access the library fine from python scripts etc. but I’ve run into a hurdle immediately out of the blocks when trying to save a builder project from the Psychopy software. I’m guessing there is something wrong with my installation?

I can open/create python scripts and save them in the coder view without issue.

I’ve included pertinent information using the template format below.

OS: Win10
PsychoPy version: 2021.2.3
**Standard Standalone?: Y
**What are you trying to achieve?: save a project

**What did you try to make it work?: selected different versions (20201.1, 2021.2.2, 2021.2.3)

**What specifically went wrong when you tried that?: Nothing changed - got the same error (I compared errors via online text compare and they are identical).

Include pasted full error message if possible:

Traceback (most recent call last):
File “c:\users\cratl\anaconda3\lib\site-packages\psychopy\app\builder\”, line 772, in fileSaveAs
self.fileSave(event=None, filename=newPath)
File “c:\users\cratl\anaconda3\lib\site-packages\psychopy\app\builder\”, line 731, in fileSave
filename = self.exp.saveToXML(filename)
File “c:\users\cratl\anaconda3\lib\site-packages\psychopy\”, line 329, in saveToXML
self.xmlRoot = self.xml
File “c:\users\cratl\anaconda3\lib\site-packages\psychopy\”, line 314, in xml
File “c:\users\cratl\anaconda3\lib\xml\etree\”, line 237, in append
File “c:\users\cratl\anaconda3\lib\xml\etree\”, line 259, in _assert_is_element
raise TypeError(‘expected an Element, not %s’ % type(e).name)
TypeError: expected an Element, not Element

HI again folks,

I’ve since uninstalled and reinstalled PsychoPy but I’m unfortunately still getting this save error.

Builder does let me run existing experiments but if I make any changes and try to save them it throws up the same error again. This appears to be exclusively a saving issue. The error report seems to support that interpretation too.

Does anyone have any idea what might be going on and how I might address it beyond what I’ve already tried?

Thanks for your time.


I discovered and copied the code changing solution here for the same issue in Linux and it worked for me on Windows 10:

I wonder if this should be implemented in the next version?


I’m trying to find out more about how to replicate this - I haven’t been able to replicate the issue using the standalone on a clean Win10 virtual machine and most users seem able to save experiments. So, we need to try and work out what’s different for those that can’t. Is it just particular experiments that won’t save? Maybe just experiments from a previous version? Does a blank new experiment save? Can you think of anything else that’s unusual about your system/setup/experiment that I could try and mimic?

Hi Jon,

My set-up in short: I open PsychoPy via Anaconda Powershell Prompt - I don’t appear to have PsychoPy listed in the Windows applications. I did have one listed for an older version of PsychoPy but uninstalled that and it wasn’t replaced when I installed the current version via Anaconda Powershell Prompt. Perhaps using Anaconda is part of the problem?

As to the issue: I couldn’t save a blank experiment from builder. I couldn’t save edits to an existing experiment either. I could run existing experiments. Until I changed the code as mentioned it was impossible to save anything from Builder.

Happy to help debug/recreate the issue my end if that’s something that you’d like me to do. Also happy to answer other questions.


I see. That seems most likely to be an issue with conda then. I’ll look into it at some point but I don’t typically have conda installed so I want to test that on a virtual machine so that it doesn’t start clashing with my vanilla python