Skip to content

Commit

Permalink
Fix incorrect dimension test in previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mcclure authored and Bastian Bechtold committed Dec 30, 2024
1 parent 1fc6060 commit 0812810
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions soundfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1379,8 +1379,8 @@ def _check_dtype(self, dtype):

def _array_io(self, action, array, frames):
"""Check array and call low-level IO function."""
if self.channels not in (1,2):
raise ValueError("Cannot convert: file has {0} channels, but only 1 or 2 is supported".format(self.channels))
if array.ndim not in (1,2):
raise ValueError("Invalid shape: {0!r} ({1})".format(array.shape, "0 dimensions not supported" if array.ndim < 1 else "too many dimensions"))
array_channels = 1 if array.ndim == 1 else array.shape[1]
if array_channels != self.channels:
raise ValueError("Invalid shape: {0!r} (Expected {1} channels, got {2})".format(array.shape, self.channels, array_channels))
Expand Down

0 comments on commit 0812810

Please sign in to comment.