diff options
| author | Matthias Geier <Matthias.Geier@gmail.com> | 2023-09-02 10:17:56 +0200 |
|---|---|---|
| committer | Matthias Geier <Matthias.Geier@gmail.com> | 2023-09-02 17:46:45 +0200 |
| commit | 791c09db3b187257e53f79725c13c1efdb4ff458 (patch) | |
| tree | 66fb09407255d81f0d9c0c71421925a25fae4e14 | |
| parent | 662edb56dd3568312b12cf1c6e1727b97eb1c094 (diff) | |
Import NumPy in _StreamBase.__init__
| -rw-r--r-- | sounddevice.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sounddevice.py b/sounddevice.py index fe8ca12..7fc7c10 100644 --- a/sounddevice.py +++ b/sounddevice.py @@ -769,6 +769,12 @@ class _StreamBase: """ assert kind in ('input', 'output', 'duplex') assert wrap_callback in ('array', 'buffer', None) + if wrap_callback == 'array': + # Import NumPy as early as possible, see: + # https://github.com/spatialaudio/python-sounddevice/issues/487 + import numpy + assert numpy # avoid "imported but unused" message (W0611) + if blocksize is None: blocksize = default.blocksize if clip_off is None: |
