Skip to content

Commit

Permalink
KeyError => ValueError
Browse files Browse the repository at this point in the history
Ref:
- quodlibet#321 (comment)
- a5c3785ed8d6a35868bc169f07e40e889087fd2e
  • Loading branch information
Borewit authored and phw committed Sep 11, 2018
1 parent 693ea0e commit f8bc6c7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions mutagen/wave.py
Expand Up @@ -30,8 +30,8 @@ class WaveFile(RiffFile):
def __init__(self, fileobj):
RiffFile.__init__(self, fileobj)

if self.fileType != u'WAVE':
raise KeyError("Expected RIFF/WAVE.")
if self.fileType != 'WAVE':
raise ValueError("Expected RIFF/WAVE.")


class WaveStreamInfo(StreamInfo):
Expand Down Expand Up @@ -62,7 +62,7 @@ def __init__(self, fileobj):

waveFile = WaveFile(fileobj)
try:
waveFormatChunk = waveFile[u'fmt ']
waveFormatChunk = waveFile['fmt ']
except KeyError as e:
raise error(str(e))

Expand Down Expand Up @@ -100,7 +100,7 @@ class _WaveID3(ID3):

def _pre_load_header(self, fileobj):
try:
fileobj.seek(WaveFile(fileobj)[u'id3 '].data_offset)
fileobj.seek(WaveFile(fileobj)['id3 '].data_offset)
except (InvalidChunk, KeyError):
raise ID3NoHeaderError("No ID3 chunk")

Expand All @@ -113,10 +113,10 @@ def save(self, filething, v2_version=4, v23_sep='/', padding=None):

wave_file = WaveFile(fileobj)

if u'id3 ' not in wave_file:
wave_file.insert_chunk(u'id3 ')
if 'id3 ' not in wave_file:
wave_file.insert_chunk('id3 ')

chunk = wave_file[u'id3 ']
chunk = wave_file['id3 ']

try:
data = self._prepare_data(
Expand Down

0 comments on commit f8bc6c7

Please sign in to comment.