A recurring problem: AttributeError: '_MasterStream' object has no attribute 'handle'

OS (e.g. Win10): Win11
PsychoPy version (e.g. 1.84.x): 2023.2.1
Standard Standalone? (y/n) y
What are you trying to achieve?:
I’m still getting familiar with PsychoPy and I want to add a sound into the experiment
What did you try to make it work?:
I clicked stimuli>>sound, and I selected a .wav file in my computer.
What specifically went wrong when you tried that?:
Include pasted full error message if possible. “That didn’t work” is not enough information.
Here’s what it said:
C:\Program Files\PsychoPy\lib\site-packages\scipy_init_.py:146: UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.24.4
warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}"
0.8582 WARNING Monitor specification not found. Creating a temporary one…
ioHub Server Process Completed With Code: 0
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychtoolbox\audio.py”, line 236, in del
self.close()
File “C:\Program Files\PsychoPy\lib\site-packages\psychtoolbox\audio.py”, line 146, in close
raise err
File “C:\Program Files\PsychoPy\lib\site-packages\psychtoolbox\audio.py”, line 139, in close
PsychPortAudio(‘Close’, self.handle)
AttributeError: ‘_MasterStream’ object has no attribute ‘handle’
################# Experiment ended with exit code 1 [pid:388] ##################
51420.2551 INFO Loaded monitor calibration from [‘2023_08_26 18:56’]

I will be grateful for any help you can provide.

Could you upload the minimal experiment file that demonstrates the problem, and also the sound file you tried to play? It’s very hard to guess the issue from the current info. Thanks

Is there a microphone component? If so, try changing the frequency to DVD quality from “voice”.


untitled.psyexp (7.6 KB)

Hi everyone, thanks for your responses. Here are the files. Once I choose ‘stimuli >> sound’ and add any .wav file, it just crashes. Would you recommend me to reinstall PsychoPy? Or it crashed because I accidentally left out some details.

I truly appreciate your help.

I’ve tried this, but there is no microphone component in the experiment; thank you! :grinning:

You could try a different audio library.