summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/play_file.py7
-rwxr-xr-xexamples/spectrogram.py2
-rwxr-xr-xexamples/wire.py7
3 files changed, 9 insertions, 7 deletions
diff --git a/examples/play_file.py b/examples/play_file.py
index cbbe828..402d814 100755
--- a/examples/play_file.py
+++ b/examples/play_file.py
@@ -20,6 +20,7 @@ try:
status = sd.get_status()
if status:
logging.warning(str(status))
-except BaseException as e:
- # This avoids printing the traceback, especially if Ctrl-C is used.
- raise SystemExit(str(e))
+except KeyboardInterrupt:
+ parser.exit('\nInterrupted by user')
+except Exception as e:
+ parser.exit(type(e).__name__ + ': ' + str(e))
diff --git a/examples/spectrogram.py b/examples/spectrogram.py
index 54506b6..e112414 100755
--- a/examples/spectrogram.py
+++ b/examples/spectrogram.py
@@ -94,4 +94,4 @@ try:
except KeyboardInterrupt:
parser.exit('Interrupted by user')
except Exception as e:
- parser.exit(str(e))
+ parser.exit(type(e).__name__ + ': ' + str(e))
diff --git a/examples/wire.py b/examples/wire.py
index 6acdeb1..7ee4000 100755
--- a/examples/wire.py
+++ b/examples/wire.py
@@ -39,6 +39,7 @@ try:
if callback_status:
logging.warning(str(callback_status))
-except BaseException as e:
- # This avoids printing the traceback, especially if Ctrl-C is used.
- raise SystemExit(str(e))
+except KeyboardInterrupt:
+ parser.exit('\nInterrupted by user')
+except Exception as e:
+ parser.exit(type(e).__name__ + ': ' + str(e))