psychopy.org | Reference | Downloads | Github

Can't play sound file

Hi,
I am very new to PsychoPy and am trying to explore and learn more about this program by creating a simple task in which participants will hear one word each time and have to repeat it back to the experimenter. I kept getting an error message as below and not sure what that is. Any comments and suggestions will be greatly appreciated!

JH

############ Running: C:\Users\user\Desktop\test\testExp_lastrun.py ############
pyo version 0.8.7 (uses single precision)
Traceback (most recent call last):
File “C:\Users\user\Desktop\test\testExp_lastrun.py”, line 69, in
soundplay = sound.Sound(u’sounds/bp.wav’, secs=-1)
File “D:\Psychopy\PsychoPy2\lib\site-packages\psychopy\sound\backend_pyo.py”, line 279, in init
init(rate=sampleRate)
File “D:\Psychopy\PsychoPy2\lib\site-packages\psychopy\sound\backend_pyo.py”, line 128, in init
audioDriver, outputID = _bestDriver(devNames, devIDs)
File “D:\Psychopy\PsychoPy2\lib\site-packages\psychopy\sound\backend_pyo.py”, line 26, in _bestDriver
preferredDrivers = prefs.general[‘audioDriver’]
File “D:\Psychopy\PsychoPy2\lib\site-packages\configobj.py”, line 563, in getitem
new = [_check(entry) for entry in val]
UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xb3 in position 0: invalid start byte

Hello all,

After trying a few possible solutions but with no success, I found this post online (https://trac.osgeo.org/osgeo4w/ticket/422) and have my problem solved.
What I did was to create a “sitecustomize.py” file and add the file into the “Lib” folder.

The code in the file is as below:

import sys
reload(sys)
sys.setdefaultencoding(‘utf-8’)

2 Likes