Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Lib/wave.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ def _read_fmt_chunk(self, chunk):
self._sampwidth = (sampwidth + 7) // 8
else:
raise Error('unknown format: %r' % (wFormatTag,))
if self._channels == 0:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am not mistaken, then this attribute was called _nchannels in previous versions of Python, i.e. 3.4.x. It might be a good idea to use the getnchannels() method to access this information instead, which abstracts the concrete name. This has the advantage of making this patch applicable to previous versions of Python, too.

raise ValueError("The audio file in wav format should have at least one channel!")
self._framesize = self._nchannels * self._sampwidth
self._comptype = 'NONE'
self._compname = 'not compressed'
Expand Down