psychopy.org | Reference | Downloads | Github

"IndexError: list index out of range" when opening Preferences

Hi all,

For some reason when I try to open the PsychoPy preferences, I get the following error message:

Traceback (most recent call last):
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\_psychopyApp.py", line 770, in showPrefs
    from psychopy.app.preferencesDlg import PreferencesDlg
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\preferencesDlg.py", line 21, in <module>
    from psychopy import sound
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\__init__.py", line 157, in <module>
    elif dev not in backend.getDevices(kind='output'):
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\backend_pyo.py", line 135, in getDevices
    inputs, outputs = get_devices_infos()
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\backend_pyo.py", line 93, in get_devices_infos
    devices = _query_devices()
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\backend_pyo.py", line 86, in _query_devices
    info[v.strip().split(": ")[0]] = v.strip().split(": ")[1]
IndexError: list index out of range
29.8546     INFO     sound is using audioLib: pyo
29.8547     WARNING     We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use ['pyo', 'pygame', 'sounddevice'] (in that order).

This error appears even when no experiment is loaded in the Builder window.

Have rebooted the PC, restarted PsychoPy and even reinstalled it… Not sure what else I can try?..


OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2020.1.3

You could try to clean the app preferences: https://www.psychopy.org/troubleshooting.html#cleaning-preferences-and-app-data

1 Like

Thank you Lukas, that worked.
For the record, I first tried removing dodgy or by me unrecognised bits from the CFG files, and when that did not help, I deleted both files (moved them to a different folder) which allowed psychoPy to open its prefs.
Not sure what led to the CFGs being corrupted, but at least I can now start from scratch.
Thanks again!

OK so it seems this is a symptom of a networks of bugs (possibly related to the 2020.1.3 version) that runs quite deep and is hard to pinpoint. I’ve spent the last hours trying to figure out what the problem is exactly, till I got stuck again - so hopefully someone can help out.

If in the hardware prefs, the first in the list of audio libraries is:

  • ‘pyo’, then I get the “IndexError: list index out of range” error reported above, that others also reported, although their problem was not followed through to a solution
  • ‘sounddevice’, then I get inaccurate sound delivery, as described in problem #3 that I reported here a while ago - again, no luck with replies
  • ‘PTB’, then there is no sound coming through the speakers when the stimuli are played back in the experiment

The list of preferences for the audio drivers on the other hand appear in my testing to make no difference.

I have an on-board Realtek soundcard (Lenovo laptop) that otherwise works fine. With the exception of the second point above, I’ve not had these problems in the previous (pre 2020) versions of psychopy, thus I imagine this is related to the changes in v2020.

Finally, as a purely ‘cosmetic’ bug in this version, when any change is made to said lists of prefences, the Units are set back to deg although they were previously set to norm.

I very much hope to be able to make progress with this - thanks in advance for any help!!

Does anybody have any suggestion what I can try with this ongoing problem?
Happy to provide more info if needed - was just trying to keep the post as brief as possible.
Thank you!

Dear PsychoPy experts,

I was wondering whether any essential information is missing from this bug/error report, or whether it is not getting replies for some other reasons. I am presently unable to continue with this project as all that I’ve tried did not work (hence the need to post here).

Again, would very much appreciate any helping hand!
Tudor