This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jbit
Recipients jbit
Date 2010-07-13.11:47:46
SpamBayes Score 0.089231655
Marked as misclassified No
Message-id <1279021669.64.0.945928628097.issue9243@psf.upfronthosting.co.za>
In-reply-to
Content
http://svn.python.org/view/python/branches/py3k/Lib/sndhdr.py?r1=56957&r2=56987 seems to have broken sndhdr as it incorrectly detects files as voc (all that time ago and nobody has noticed...):

[jbit@miku]~$ xxd test.wav | head -n 1
0000000: 5249 4646 2478 e001 5741 5645 666d 7420  RIFF$x..WAVEfmt 
[jbit@miku]~$ python3.1
>>> import sndhdr
>>> sndhdr.what("test.wav")
('voc', 0, 1, -1, 8)

I'm a little unsure why it got changed from indexing to startswith() at all, but changes like the following are just totally incorrect.
-    if h[:20] != b'Creative Voice File\032':
+    if h.startswith(b'Creative Voice File\032'):

Attached is a patch against the py3k branch which fixes the issue as well as some other things obviously broken by the same changelist, although it might be a good idea to review the changelist again to make sure there's nothing else obviously broken :)
>>> sndhdr.what("test.wav")
('wav', 48000, 2, -1, 16)
History
Date User Action Args
2010-07-13 11:47:49jbitsetrecipients: + jbit
2010-07-13 11:47:49jbitsetmessageid: <1279021669.64.0.945928628097.issue9243@psf.upfronthosting.co.za>
2010-07-13 11:47:48jbitlinkissue9243 messages
2010-07-13 11:47:47jbitcreate