Preferences do not stick

First post, so I really do not know what I am doing, and could not find this asked already …

In the Builder, I go to File > Preferences and make a change (e.g., change units from ‘deg’ to ‘norm’), click OK, then reopen Preferences, and my changes have reverted to the default. I cannot get my Preferences to stick. What am I doing wrong?

Background details:
Dell Optiplex 990
Windows 7 Professional SP1 64-bit
PsychoPy v2020.1.3 Standalone

– David McFarlane

The manual (v. 2020.1.2) says that the preferences are saved in userPrefs.cfg, so I thought I would just go an manually edit that. I found userPrefs.cfg in %AppData%\Roaming\psychopy3, made a backup copy, and then edited the file. When I restarted PsychoPy and went to File > Preferences, it did not show my changes, but when I looked at the .cfg file it still had my changes. Could someone explain this? Thanks.

– David McFarlane

I’m experiencing the same issue. I reset the preferences using the GUI, then re-opened PsychoPy, selected my preferences and checked “auto-save prefs” in the App tab. Still, nothing stuck in the GUI, but when I checked the file in %AppData%\Roaming\psychopy3 and the prefs in coder view, it seems that the selected preferences must have stuck.
Perhaps the units variable just reverses to default in the GUI?

You can check the imported preferences in the coder:

from psychopy import prefs

We’ve made some changes to preferences in 2020.2, could you try installing the newest version and see if that fixes it? If not then that may be a problem with how the prefs file is read which we’ll need to look into

Bad news. I clicked ‘Preferences’ in Builder and checked in Coder, but got this:

Traceback (most recent call last):
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\", line 802, in showPrefs
    prefsDlg = PreferencesDlg(app=self)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\", line 517, in __init__
    devnames = sorted(sound.getDevices('output'))
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\", line 135, in getDevices
    inputs, outputs = get_devices_infos()
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\", line 93, in get_devices_infos
    devices = _query_devices()
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\", line 86, in _query_devices
    info[v.strip().split(": ")[0]] = v.strip().split(": ")[1]
IndexError: list index out of range

The experiment itself runs fine. (Edit: I installed 2020.2.2.)

It may be this was the error which was preventing your prefs from saving previously - it looks like it’s trying to get a list of your sound devices and getting nothing back, so is hitting an index error when it looks for the 1st element as there are 0 elements. I’ll look into this, it should be simple to add something to catch this error so that at least the rest of your prefs can save, but I’ll try to figure out specifically why it can’t get access to your sound devices!

The issue went away after I reset the preferences manually in Coder (using PsychoPy 2020.2.4), and then restarted PsychoPy. This might be a bit superfluous, but it worked:

from psychopy import prefs