Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e266344

Browse files
committed
New 'finally' syntax
1 parent 4128ded commit e266344

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

Demo/sgi/al/intercom.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -181,21 +181,22 @@ def ioloop1(s, otheraddr):
181181
# Child -- microphone handler
182182
log('child started')
183183
try:
184-
mike = al.openport('mike', 'r', config)
185-
# Sleep a while to let the other side get started
186-
time.sleep(1)
187-
# Drain the queue before starting to read
188-
data = mike.readsamps(mike.getfilled())
189-
# Loop, sending packets from the mike to the net
190-
while 1:
191-
data = mike.readsamps(SAMPSPERBUF)
192-
s.sendto(data, otheraddr)
193-
except KeyboardInterrupt:
194-
log('child got interrupt; exiting')
195-
posix._exit(0)
196-
except error:
197-
log('child got error; exiting')
198-
posix._exit(1)
184+
try:
185+
mike = al.openport('mike', 'r', config)
186+
# Sleep a while to let the other side get started
187+
time.sleep(1)
188+
# Drain the queue before starting to read
189+
data = mike.readsamps(mike.getfilled())
190+
# Loop, sending packets from the mike to the net
191+
while 1:
192+
data = mike.readsamps(SAMPSPERBUF)
193+
s.sendto(data, otheraddr)
194+
except KeyboardInterrupt:
195+
log('child got interrupt; exiting')
196+
posix._exit(0)
197+
except error:
198+
log('child got error; exiting')
199+
posix._exit(1)
199200
finally:
200201
log('child got unexpected error; leaving w/ traceback')
201202

0 commit comments

Comments
 (0)