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

**URL:** <https://discourse.psychopy.org/t/indexerror-list-index-out-of-range-when-opening-preferences/14436>\
**Category:** Builder\
**Created:** [June 21, 2020, 9:09pm UTC](https://discourse.psychopy.org/t/indexerror-list-index-out-of-range-when-opening-preferences/14436 "2020-06-21T21:09:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tudor](https://avatars.discourse-cdn.com/v4/letter/t/13edae/32.png) [@tudor](https://discourse.psychopy.org/u/tudor)\
**Post date:** [June 21, 2020, 9:09pm UTC](https://discourse.psychopy.org/t/indexerror-list-index-out-of-range-when-opening-preferences/14436/1 "2020-06-21T21:09:40Z")

</div>

Hi all,

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

```auto
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

---

<div class="post-metadata">

**Author:** ![LukasPsy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/lukaspsy/32/4582_2.png) [@LukasPsy](https://discourse.psychopy.org/u/LukasPsy)\
**Post date:** [June 22, 2020, 7:54am UTC](https://discourse.psychopy.org/t/indexerror-list-index-out-of-range-when-opening-preferences/14436/2 "2020-06-22T07:54:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tudor](https://avatars.discourse-cdn.com/v4/letter/t/13edae/32.png) [@tudor](https://discourse.psychopy.org/u/tudor)\
**Post date:** [June 22, 2020, 8:34am UTC](https://discourse.psychopy.org/t/indexerror-list-index-out-of-range-when-opening-preferences/14436/3 "2020-06-22T08:34:01Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![tudor](https://avatars.discourse-cdn.com/v4/letter/t/13edae/32.png) [@tudor](https://discourse.psychopy.org/u/tudor)\
**Post date:** [June 22, 2020, 3:48pm UTC](https://discourse.psychopy.org/t/indexerror-list-index-out-of-range-when-opening-preferences/14436/4 "2020-06-22T15:48:39Z")

</div>

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](https://discourse.psychopy.org/t/cant-record-sound-in-experiment-on-psychopy/13113), 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](https://discourse.psychopy.org/t/none-output-values-and-possible-consequences-of-psychopys-slip-timing-issues/10818) 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!!

---

<div class="post-metadata">

**Author:** ![tudor](https://avatars.discourse-cdn.com/v4/letter/t/13edae/32.png) [@tudor](https://discourse.psychopy.org/u/tudor)\
**Post date:** [June 25, 2020, 2:08pm UTC](https://discourse.psychopy.org/t/indexerror-list-index-out-of-range-when-opening-preferences/14436/5 "2020-06-25T14:08:54Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![tudor](https://avatars.discourse-cdn.com/v4/letter/t/13edae/32.png) [@tudor](https://discourse.psychopy.org/u/tudor)\
**Post date:** [July 1, 2020, 10:23am UTC](https://discourse.psychopy.org/t/indexerror-list-index-out-of-range-when-opening-preferences/14436/6 "2020-07-01T10:23:46Z")

</div>

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
