Commit df1ba672 authored by Fred Drake's avatar Fred Drake

- 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
parent 08fd21d4
...@@ -13,7 +13,7 @@ import audioop ...@@ -13,7 +13,7 @@ import audioop
SND_FORMAT_MULAW_8 = 1 SND_FORMAT_MULAW_8 = 1
def read_sound_file(path): def read_sound_file(path):
fp = open(path, 'r') fp = open(path, 'rb')
size, enc, rate, nchannels, extra = sunaudio.gethdr(fp) size, enc, rate, nchannels, extra = sunaudio.gethdr(fp)
data = fp.read() data = fp.read()
fp.close() fp.close()
...@@ -30,7 +30,7 @@ def read_sound_file(path): ...@@ -30,7 +30,7 @@ def read_sound_file(path):
def play_sound_file(data, rate, ssize, nchannels): def play_sound_file(data, rate, ssize, nchannels):
try: try:
a = ossaudiodev.open('w') a = ossaudiodev.open('w')
except ossaudiodev.error, msg: except IOError, msg:
if msg[0] in (errno.EACCES, errno.ENODEV, errno.EBUSY): if msg[0] in (errno.EACCES, errno.ENODEV, errno.EBUSY):
raise TestSkipped, msg raise TestSkipped, msg
raise TestFailed, msg raise TestFailed, msg
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment