[New-bugs-announce] [issue11620] winsound.PlaySound() with SND_MEMORY should accept bytes instead of strings

Tom Felker report at bugs.python.org
Mon Mar 21 01:34:41 CET 2011


New submission from Tom Felker <tomfelker at gmail.com>:

PlaySound supposedly lets you play a .WAV file whose contents are stored in a string, by passing the string and flags including winsound.SND_MEMORY.  I'm trying to use BytesIO object and the wave module to make a file in-memory, and pass this to winsound.  It's a TypeError if I pass the resultant bytes object directly, and if I pass a string object, I get

TypeError: must be str without null character or None, not str

Since wav files can contain zeros, for the feature to work at all, the C code would need to detect the SND_MEMORY flag and interpret the first argument as a bytes object, instead of a null-terminated string, in that case.

----------
components: Library (Lib)
messages: 131583
nosy: Tom.Felker
priority: normal
severity: normal
status: open
title: winsound.PlaySound() with SND_MEMORY should accept bytes instead of strings
versions: Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11620>
_______________________________________


More information about the New-bugs-announce mailing list