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 johnnypops
Recipients
Date 2004-07-31.03:17:37
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
If you pass a unicode string to wave.open() it is treated as if it 
was an open file object and fails with an AttributeError. For 
example, the following code behaves correctly: 
 
import wave 
f = wave.open("sound.wav", "r") 
 
but this fails: 
 
import wave 
f = wave.open(u"sound.wav", "r") 
 
... 
AttributeError: 'unicode' object has no attribute 'read' 
 
The error occurs twice in the file 'wave.py' in the __init__ functions 
for Wave_read and Wave_write. 
 
I was playing with the unicode version of wxPython on Windows 
XP at the time, but the bug applies to other platforms as well.  
 
Hope the patch is of use, 
 
best regards, 
John. 
 
---8<--------------------------------------------------------------- 
158c158 
<         if type(f) == type(''): 
--- 
>         if isinstance(f, basestring): 
297c297 
<         if type(f) == type(''): 
--- 
>         if isinstance(f, basestring): 
 
History
Date User Action Args
2007-08-23 14:24:41adminlinkissue1001053 messages
2007-08-23 14:24:41admincreate