diff options
| author | Roel Postelmans <roel.postelmans@altran.com> | 2017-10-21 09:49:21 +0200 |
|---|---|---|
| committer | Matthias Geier <Matthias.Geier@gmail.com> | 2017-10-21 09:49:21 +0200 |
| commit | 100abeb812ac3ec59efcad1cb062b462f2e2d2a6 (patch) | |
| tree | 4c8dee62fd1ecf90413aa0235c9d17144b0dada0 /sounddevice.py | |
| parent | 0e9187adfc4bc746da94cb06fc5fea01822e7c1c (diff) | |
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
Diffstat (limited to 'sounddevice.py')
| -rw-r--r-- | sounddevice.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sounddevice.py b/sounddevice.py index c548286..c73d94c 100644 --- a/sounddevice.py +++ b/sounddevice.py @@ -60,6 +60,11 @@ _sampleformats = { _initialized = 0 _last_callback = None +try: + _basestring = basestring +except NameError: + _basestring = (str, bytes) + def play(data, samplerate=None, mapping=None, blocking=False, loop=False, **kwargs): @@ -2497,7 +2502,7 @@ def _array(buffer, channels, dtype): def _split(value): """Split input/output value into two values.""" - if isinstance(value, str): + if isinstance(value, _basestring): # iterable, but not meant for splitting return value, value try: |
