Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
BF: Non-ASCII audio driver names causes error
  • 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
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:
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
"""
osEncoding = sys.getfilesystemencoding()
inputs, outputs = pyo.pa_get_devices_infos()
if kind is None:
allDevs = inputs.update(outputs)
Expand All @@ -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

Expand Down

0 comments on commit c1ff68f

Please sign in to comment.