mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
- be explicit: audio data files should be opened in binary mode
- ossaudiodev.open() raises IOError, not ossaudiodev.error, for cases which get mapped to TestSkipped
This commit is contained in:
parent
55d555f012
commit
7511bd957d
1 changed files with 2 additions and 2 deletions
|
@ -13,7 +13,7 @@ import audioop
|
|||
SND_FORMAT_MULAW_8 = 1
|
||||
|
||||
def read_sound_file(path):
|
||||
fp = open(path, 'r')
|
||||
fp = open(path, 'rb')
|
||||
size, enc, rate, nchannels, extra = sunaudio.gethdr(fp)
|
||||
data = fp.read()
|
||||
fp.close()
|
||||
|
@ -30,7 +30,7 @@ def read_sound_file(path):
|
|||
def play_sound_file(data, rate, ssize, nchannels):
|
||||
try:
|
||||
a = ossaudiodev.open('w')
|
||||
except ossaudiodev.error, msg:
|
||||
except IOError, msg:
|
||||
if msg[0] in (errno.EACCES, errno.ENODEV, errno.EBUSY):
|
||||
raise TestSkipped, msg
|
||||
raise TestFailed, msg
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue