[ python-Bugs-1439659 ] file to store pickled object should be opened in binary mode

SourceForge.net noreply at sourceforge.net
Mon Mar 6 04:36:24 CET 2006


Bugs item #1439659, was opened at 2006-02-27 09:51
Message generated for change (Comment added) made by tjreedy
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1439659&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: Documentation
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Raghuram Devarakonda (draghuram)
Assigned to: Nobody/Anonymous (nobody)
Summary: file to store pickled object should be opened in binary mode

Initial Comment:

Hi,

To unpickle objects on UNIX that were pickled on
windows, the file should be opened in binary mode for
read and write on windows. It will be nice to have this
mentioned in the doc. Something along these lines will
be good enough:

"Please note that if you are writing the pickled object
to a file on windows, make sure it is opened in binary
mode. Otherwise, the file may not be able to be used to
unpickle on other non-windows platforms".

Thanks,
Raghu. 

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

>Comment By: Terry J. Reedy (tjreedy)
Date: 2006-03-05 22:36

Message:
Logged In: YES 
user_id=593130

For ASCII protocol pickles, intended for human 
readability, one should use text mode to be able to read 
the file, for instance, in Notepad.

For either binary protocol, I would think binary mode 
should be best even to reread on Windows.  If anything is 
added, I would put
"On Windows, open files in a mode (text/binary) that 
matches the protocol."
at the bottom of http://docs.python.org/lib/node64.html

Looking forward to 3.0, when file mode might be more 
significant (text/binary corresponding to unicode/bytes), 
the "for windoews' qualifier might be omitted, but this 
might be premature.

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

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


More information about the Python-bugs-list mailing list