Skip to content

Commit 100abeb

Browse files
Roel Postelmansmgeier
authored andcommitted
Support for Unicode strings onPython 2.x (#104)
* Support unicode strings * Added python 3.x support for basestring * The analog to basestring in python3 is a combination of bytes and str
1 parent 0e9187a commit 100abeb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sounddevice.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@
6060
_initialized = 0
6161
_last_callback = None
6262

63+
try:
64+
_basestring = basestring
65+
except NameError:
66+
_basestring = (str, bytes)
67+
6368

6469
def play(data, samplerate=None, mapping=None, blocking=False, loop=False,
6570
**kwargs):
@@ -2497,7 +2502,7 @@ def _array(buffer, channels, dtype):
24972502

24982503
def _split(value):
24992504
"""Split input/output value into two values."""
2500-
if isinstance(value, str):
2505+
if isinstance(value, _basestring):
25012506
# iterable, but not meant for splitting
25022507
return value, value
25032508
try:

0 commit comments

Comments
 (0)