[ python-Bugs-1467309 ] open should default to binary mode on windows

SourceForge.net noreply at sourceforge.net
Mon Apr 10 02:45:46 CEST 2006


Bugs item #1467309, was opened at 2006-04-09 20:42
Message generated for change (Comment added) made by twouters
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1467309&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: None
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: Adam Hupp (hupp)
Assigned to: Nobody/Anonymous (nobody)
Summary: open should default to binary mode on windows

Initial Comment:
On windows the open() function defaults to reading
files in text mode.  To get a binary mode file I need
to append a "b" to the mode string.  I think this is an
unnessary platform inconsistency.  Twice now I've had
hard to track down bugs because I was reading a file in
text mode and should have been using binary.  This is a
wart, IMO.  

I'd like to suggest that the default open mode on
windows be made binary, with an option to change it to
text if desired.  



----------------------------------------------------------------------

>Comment By: Thomas Wouters (twouters)
Date: 2006-04-10 02:45

Message:
Logged In: YES 
user_id=34209

Sorry, that would break too much existing code. For Python
3.0, where it is okay to break existing code, opening a file
will be explicitly text (with automatic decoding to Unicode)
or binary (where reading fetches you bytes, instead of a
string), and the matter will be solved.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1467309&group_id=5470


More information about the Python-bugs-list mailing list