diff options
| author | Matthias Geier <Matthias.Geier@gmail.com> | 2016-12-19 17:32:28 +0100 |
|---|---|---|
| committer | Matthias Geier <Matthias.Geier@gmail.com> | 2016-12-19 17:33:12 +0100 |
| commit | d5511cbe29b952ee8311ad4b0a473cc2bc581b10 (patch) | |
| tree | 07605bc574932967f2fa09cec1e88f765f3b2cdd /examples/play_long_file.py | |
| parent | b728182025874ba4293a7a4405fd61a3fdaa4da2 (diff) | |
Examples: Don't use the logging module, proper exit codes
Diffstat (limited to 'examples/play_long_file.py')
| -rwxr-xr-x | examples/play_long_file.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/play_long_file.py b/examples/play_long_file.py index 9c464ff..cdc37d1 100755 --- a/examples/play_long_file.py +++ b/examples/play_long_file.py @@ -10,12 +10,13 @@ of audio blocks in memory and is therefore able to play files that are larger than the available RAM. """ -from __future__ import division +from __future__ import division, print_function import argparse try: import queue # Python 3.x except ImportError: import Queue as queue # Python 2.x +import sys import threading def int_or_str(text): @@ -47,12 +48,13 @@ event = threading.Event() def callback(outdata, frames, time, status): assert frames == args.blocksize if status.output_underflow: - parser.error('An output underflow occurred: increase blocksize?') + print('Output underflow: increase blocksize?', file=sys.stderr) raise sd.CallbackAbort + assert not status try: data = q.get_nowait() except queue.Empty: - parser.error('Buffer is empty: increase buffersize?') + print('Buffer is empty: increase buffersize?', file=sys.stderr) raise sd.CallbackAbort if len(data) < len(outdata): outdata[:len(data)] = data |
