New version of Psychopy doesn't compile script

Hi, when I try compiling a script from an experiment that runs just fine when run from builder, I get the error I copy below. I could compile without problems with previous version of Psychopy (I don’t know how to figure out which one was it, now I have PsychoPy3 v2020.2.3).

OS: Windows 10
**PsychoPy version: 2020.2.3
**Standard Standalone?: yes

Error message:
Traceback (most recent call last):
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py”, line 1185, in compileScript
if self.app.prefs.general[‘useRunner’]:
File “C:\Program Files\PsychoPy3\lib\site-packages\configobj.py”, line 554, in getitem
val = dict.getitem(self, key)
KeyError: ‘useRunner’

2 Likes

I have encountered the same problem. Any solutions?

I have a quick fix: As the error says, Psychopy is looking for the prefs variable useRunner. The variable is not set in your userPrefs and you cannot set it through the builder interface for now. You can, however, go to your preference file userPrefs.cfg, which will be in a folder like %APPDATA%psychopy3 on Windows and ~/.psychopy3 on Linux/MacOS and create an entry for useRunner there.
In this file, add the line useRunner = False somewhere under this heading:

# General settings
[general]
2 Likes

The issue is in builder.compileScript(), where the function assumes that there is a prefs setting with the key 'useRunner'.

I don’t know why we didn’t have a useRunner line in the config file, because the defaults on Github say there should be: psychopy/Windows.spec

**I also encountered a similar problem in the MacOS as below**
**================================================**
**Traceback (most recent call last):**
**  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 1185, in compileScript**
**  File “configobj.pyc”, line 554, in __getitem__**
**KeyError: ‘useRunner’**
**============================================================**

**and I cannot find userPrefs.cfg file anywhere**

Gah, I thought I’d caught all of these! As @LukasPsy has already said, you can fix it temporarily by adding useRunner to your prefs file. You can also revert to 2020.2.2, as I removed useRunner in 2020.2.3.

useRunner is something we were using to let users switch between the run button sending experiments to the Runner and running them directly, however before the 2020.2 release we decided instead to implement different buttons for the two functions. That line is a leftover from this period which I missed when rolling back the changes. I think it’s because my own prefs file still has useRunner, so I wasn’t hitting that error when I was testing.

The code causing the error is no longer needed, so I’ve removed it and pushed to GitHub. The fix will be in the next release!

In my case (macOS), I could not find userPrefs.cfg file.
Instead, I inserted

useRunner = boolean(default=‘True’)

under headings Lukas mentioned

#General settings
[general]

in the preference/Darwin.spec file.

Then the compile script worked.

Is there any other solutions? I’ve tried various suggestions (adding to the Windows.spec and reverting to 2020.2.2) and I still get the same error from lines 1185 and 554 as originally posted.
I also couldn’t find the userPrefs.cfg file as someone else mentioned.

Any advice would be SO helpful :smiley: