The wave module currently raises errors without the offending value:
wave.Error: bad # of channels
wave.Error: bad sample width
wave.Error: bad frame rate
When values come from variables, configuration, or parsed data, the
traceback shows the call site but not the actual offending value. For
Wave_read, the values are parsed from the WAV file header and never
appear in the traceback at all.
Reproduction
importwave, iowave.open(io.BytesIO(), 'wb').setframerate(-1)
# wave.Error: bad frame rate
Activity
pythongh-149306: Improve error messages in wave module to include the…
pythongh-149306: Improve error messages in wave module to include the…
Merge remote-tracking branch 'upstream/main' into pythongh-149306-wav…
rhettinger commented on May 3, 2026
I'm concerned that these LLM created issues are of little value.