Permalink
Browse files

BF: Non-ASCII audio driver names causes error

  • Loading branch information...
hsogo authored and peircej committed Apr 18, 2017
1 parent e6e26ff commit c1ff68f95b5ef6d63f45df4fa9ceaae11a2603ff
Showing with 4 additions and 2 deletions.
  1. +1 −1 psychopy/sound/__init__.py
  2. +3 −1 psychopy/sound/backend_pyo.py
@@ -139,7 +139,7 @@ def setDevice(dev, kind=None):
pass # do nothing
elif dev not in backend.getDevices(kind='output'):
devNames = backend.getDevices(kind='output').keys()
logging.error("Requested audio device '{}' that is not available on "
logging.error(u"Requested audio device '{}' that is not available on "
"this hardware. The 'audioDevice' preference should be one of "
"{}".format(dev, devNames))
else:
@@ -54,6 +54,7 @@ def getDevices(kind=None):
The dict keys are names and items are dicts of properties
"""
osEncoding = sys.getfilesystemencoding()
inputs, outputs = pyo.pa_get_devices_infos()
if kind is None:
allDevs = inputs.update(outputs)
@@ -64,7 +65,8 @@ def getDevices(kind=None):
devs = {}
for ii in allDevs: # in pyo this is a dict but keys are ii ! :-/
dev = allDevs[ii]
devs[dev['name']] = dev
devName = dev['name'].decode(osEncoding) # convert to unicode
devs[devName] = dev
dev['id'] = ii
return devs

0 comments on commit c1ff68f

Please sign in to comment.