[Python-bugs-list] [ python-Bugs-446219 ] sndhdr.what() fails on some WAV files
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 30 Jul 2001 23:28:13 -0700
Bugs item #446219, was opened at 2001-07-30 20:45
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=446219&group_id=5470
Category: Python Library
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: John Popplewell (johnnypops)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: sndhdr.what() fails on some WAV files
Initial Comment:
Currently using Python 2.0.1 [final]
on Windows 95/98/2K.
Bug probably only affects Windows
>>>import sndhdr
>>>print sndhdr.what('audio.wav')
None
Should display:
('wav', 44100, 1, -1, 16)
Occurs with WAV files that have a header starting :
52 49 46 46 24 1A 01 00 ; RIFF$...
I think it is the ^Z that is screwing things up.
The fix for the code in "sndhdr.py" is :
def whathdr(filename):
"""Recognize sound headers"""
f = open(filename, 'rb')
h = f.read(512)
...
If the file is opened in binary mode then everything
is OK.
cheers,
John Popplewell
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-07-30 23:28
Message:
Logged In: YES
user_id=6380
Thanks! Fixed in CVS now.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=446219&group_id=5470