| Reference | Downloads | Github

Sounddevice module and psychopy error when quitting


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: =========
======= 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

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.