| Reference | Downloads | Github

Importing gui and data causing PYO to crash


Hello all,

I’m having an interesting problem with imports and sound.

I previously had a PYO problem as fixed here:

After this fix, however, I found that if I do either

from psychopy import gui
from psychopy import data

… the PYO server crashes on startup. I haven’t been able to find a way to avoid this problem.

Has anyone else had a similar issue? I will post some full code and a problem example tomorrow. My system is a Dell Optiplex 7040, Windows 7 Enterprise, PsychoPy 1.85.3, Anaconda 32-bit Python 2.7.

Is anyone prepared to look into this issue? If so, I’ll generate a minimal example as well.



I have created a minimal example for this crash:

from __future__ import division  # so that 1/3=0.333 instead of 1/3=0
import sys
from psychopy import prefs, sound
import # This line causes PYO to crash

prefs.general['audioLib'] = ['pyo']

print 1

The error:

pyo version 0.8.5 (uses single precision)
portaudio error in Pa_StartStream (pa_start): Invalid stream pointer
Error starting server.

Can anyone see anything wrong in how I am importing these libraries?

I have tracked the problem down to the following two lines in psychopy/data/

from .base import DataHandler 
from .experiment import ExperimentHandler

If I comment out these lines, PYO does not crash.

I am struggling to see any connection between DataHandler, ExperimentHandler and psychopy/sound. Can anyone advise me on the appropriate next steps to track down the problem?



Is there something in these imports that make use of the soundcard? Or change the sampling rate?

Also, how did you come with this kind of path? Seems wrong…



Hi Olivier,

I’m adding that path simply to import pyo, which I have installed there. It would be better to add it to the system python path.

As described in one of my other posts, I had to modify psychopy to hard-code a particular sampling rate in order to getthe pyo server to run. Do you think this hard-coded sampling rate could be causing this crash?

Best regards,



What is important about sampling rate is to be sync with the driver’s sampling rate (especially with WASAPI on Windows, don’t know about ASIO). Be sure to use the same SR in psychopy that the one set in the system’s Sound panel.

One thing you can do is to update pyo to 0.8.7, I’ve put a lot of work in this version to make it more user friendly on Windows.



Thank you Olivier - I will try the update now and check the sampling rate.