Skip to content

Commit

Permalink
BF: Non-ASCII audio driver names causes error
Browse files Browse the repository at this point in the history
  • Loading branch information
hsogo authored and peircej committed Jun 15, 2017
1 parent e6e26ff commit c1ff68f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion psychopy/sound/__init__.py
Expand Up @@ -139,7 +139,7 @@ def setDevice(dev, kind=None):
pass # do nothing pass # do nothing
elif dev not in backend.getDevices(kind='output'): elif dev not in backend.getDevices(kind='output'):
devNames = backend.getDevices(kind='output').keys() 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 " "this hardware. The 'audioDevice' preference should be one of "
"{}".format(dev, devNames)) "{}".format(dev, devNames))
else: else:
Expand Down
4 changes: 3 additions & 1 deletion psychopy/sound/backend_pyo.py
Expand Up @@ -54,6 +54,7 @@ def getDevices(kind=None):
The dict keys are names and items are dicts of properties The dict keys are names and items are dicts of properties
""" """
osEncoding = sys.getfilesystemencoding()
inputs, outputs = pyo.pa_get_devices_infos() inputs, outputs = pyo.pa_get_devices_infos()
if kind is None: if kind is None:
allDevs = inputs.update(outputs) allDevs = inputs.update(outputs)
Expand All @@ -64,7 +65,8 @@ def getDevices(kind=None):
devs = {} devs = {}
for ii in allDevs: # in pyo this is a dict but keys are ii ! :-/ for ii in allDevs: # in pyo this is a dict but keys are ii ! :-/
dev = allDevs[ii] dev = allDevs[ii]
devs[dev['name']] = dev devName = dev['name'].decode(osEncoding) # convert to unicode
devs[devName] = dev
dev['id'] = ii dev['id'] = ii
return devs return devs


Expand Down

0 comments on commit c1ff68f

Please sign in to comment.