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

SourceForge.net noreply at sourceforge.net
Mon Apr 10 04:02:28 CEST 2006


Bugs item #1467309, was opened at 2006-04-09 14:42
Message generated for change (Comment added) made by tim_one
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: Not a Bug
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: Tim Peters (tim_one)
Date: 2006-04-09 22:02

Message:
Logged In: YES 
user_id=31435

Closing this.  It can't be changed now without breaking
mountains of code, and it's debatable that changing it would
be a good idea even if not (Python follows C exactly in this
respect now -- but there's no need to debate it since it
ain't  gonna happen before Python 3 regardless). 

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

Comment By: Thomas Wouters (twouters)
Date: 2006-04-09 20: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