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.

Title: with unicode filename fails
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: johnnypops, nnorwitz
Priority: normal Keywords:

Created on 2004-07-31 03:17 by johnnypops, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg21882 - (view) Author: John Popplewell (johnnypops) Date: 2004-07-31 03:17
If you pass a unicode string to 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 ="sound.wav", "r") 
but this fails: 
import wave 
f ="sound.wav", "r") 
AttributeError: 'unicode' object has no attribute 'read' 
The error occurs twice in the file '' 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, 
<         if type(f) == type(''): 
>         if isinstance(f, basestring): 
<         if type(f) == type(''): 
>         if isinstance(f, basestring): 
msg21883 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2004-08-01 22:48
Logged In: YES 


Checked in as Lib/ 1.18
Date User Action Args
2022-04-11 14:56:06adminsetgithub: 40664
2004-07-31 03:17:37johnnypopscreate