Sounddevice module and psychopy error when quitting

Hi,

when loading the sounddevice module after the visual or event module from psychopy (no problem with core) I get an error message when finishing or quitting the script (sys.exit()):

*** Error in `python’: free(): invalid pointer: 0x00007fc9289b8540 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x6ef45)[0x7fc92868af45]
/lib/x86_64-linux-gnu/libc.so.6(+0x746b6)[0x7fc9286906b6]
/lib/x86_64-linux-gnu/libc.so.6(+0x74e9e)[0x7fc928690e9e]
/lib/x86_64-linux-gnu/libc.so.6(fclose+0x103)[0x7fc9286815f3]
/usr/lib/x86_64-linux-gnu/libopenal.so.1(+0xae13)[0x7fc909480e13]
/lib64/ld-linux-x86-64.so.2(+0xf9b7)[0x7fc9295109b7]
/lib/x86_64-linux-gnu/libc.so.6(+0x35b78)[0x7fc928651b78]
/lib/x86_64-linux-gnu/libc.so.6(+0x35bc5)[0x7fc928651bc5]
python[0x52540f]
python[0x52288d]
python(PyErr_PrintEx+0x36)[0x522176]
python[0x42ec24]
python(Py_Main+0x6c1)[0x49dc51]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fc92863c730]
python(_start+0x29)[0x49d4a9]
======= Memory map: ========
00400000-006eb000 r-xp 00000000 08:03 4982615 /usr/bin/python2.7
008eb000-008ed000 r–p 002eb000 08:03 4982615 /usr/bin/python2.7
008ed000-00964000 rw-p 002ed000 08:03 4982615 /usr/bin/python2.7
00964000-00987000 rw-p 00000000 00:00 0
022c3000-07fa3000 rw-p 00000000 00:00 0 [heap]
7fc8ec000000-7fc8ec021000 rw-p 00000000 00:00 0

minimal example causing the error:
from psychopy import event
import sounddevice

this is fine:
import sounddevice
from psychopy import event

The workaround for now is just to import sounddevice before the psychopy modules.

I’m running debian unstable with psychopy ‘1.83.04’

If anybody has a clue about it, would be nice to know any ideas to solve this.

best wishes
Piotr

No idea. I expect it means that pyglet and sounddevice are colliding somewhere. We’ve seen this behaviour from pyglet before in connection with scipy and with wx; it just doesn’t seem to play nicely with other modules.