Skip to content

Commit 8335451

Browse files
committed
DOC: Fix pre-buffering bug in play_file.py example program
1 parent 1a1a109 commit 8335451

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

examples/play_file.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,8 @@ def process(frames):
9090
client.outports.register('out_{0}'.format(ch + 1))
9191
block_generator = f.blocks(blocksize=blocksize, dtype='float32',
9292
always_2d=True, fill_value=0)
93-
try:
94-
for data in block_generator:
95-
q.put_nowait(data)
96-
except queue.Full:
97-
pass
93+
for _, data in zip(range(args.buffersize), block_generator):
94+
q.put_nowait(data) # Pre-fill queue
9895
with client:
9996
if not args.manual:
10097
target_ports = client.get_ports(
@@ -117,4 +114,4 @@ def process(frames):
117114
# A timeout occured, i.e. there was an error in the callback
118115
parser.exit(1)
119116
except Exception as e:
120-
parser.exit(e)
117+
parser.exit(type(e).__name__ + ': ' + str(e))

0 commit comments

Comments
 (0)