summaryrefslogtreecommitdiff
path: root/examples/asyncio_coroutines.py
diff options
context:
space:
mode:
authorMatthias Geier <Matthias.Geier@gmail.com>2019-09-17 20:12:20 +0200
committerMatthias Geier <Matthias.Geier@gmail.com>2019-09-18 13:10:33 +0200
commita82b9b56d44ed37c587648685826ad56b9177533 (patch)
treebd72d8becf6caaf2079cd4f31db42db4f7cba289 /examples/asyncio_coroutines.py
parente8253a615d6f70f7a1f6bc662e703a857fd2e8c4 (diff)
DOC: Update examples
Diffstat (limited to 'examples/asyncio_coroutines.py')
-rwxr-xr-xexamples/asyncio_coroutines.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/asyncio_coroutines.py b/examples/asyncio_coroutines.py
index af6d707..d31a1e3 100755
--- a/examples/asyncio_coroutines.py
+++ b/examples/asyncio_coroutines.py
@@ -8,6 +8,7 @@ You need Python 3.7 or newer to run this.
"""
import asyncio
+import sys
import numpy as np
import sounddevice as sd
@@ -70,4 +71,7 @@ async def main(frames=150_000, channels=1, dtype='float32', **kwargs):
if __name__ == "__main__":
- asyncio.run(main())
+ try:
+ asyncio.run(main())
+ except KeyboardInterrupt:
+ sys.exit('\nInterrupted by user')