I do not know all the details, but I think it is NOT portable. The reason I am saying this is from a comment in Mark Summerfields excellent book "Rapid GUI programming with Python and Qt" where he has an example that uses several different load/save methods (chapter 8). He recommends using Qt's QDataStream method to write/read binary fields over pickle/cpickle because the Qt method is fully platform independent and it can handle Qt classes more effortlessly.
He writes that files written with QDataStream are platform-independent; the class automatically takes care of endianess and word size. Since he does not say this about pickle I infer from this that files written by pickle does not take care of endianess or word size automatically. Sorry for the guesswork as I might be wrong, but I hope this will guide you in the right direction or that others will come up with more correct answers. Regards, Bjorn On Wed, May 5, 2010 at 6:12 PM, Garry Willgoose < garry.willgo...@newcastle.edu.au> wrote: > I have seen conflicting info on this on the web and in the tutor archive > and the docs don't seem to address it explicitly. How portable are files > containing pickle'd and shelve'd data? I'm thinking issues like simply O/S > portability, through big-end/little-end hardware (for floats/integers which > I use a lot), and then for unicode/non-unicode string, 64/32 bit and > V2.6/V3.1 implementations of python. Does the version of the encoder in > pickle make any difference for this? One post I've seen suggests that as > long as the file is opened binary (ie. 'b') all should be well for platform > independence. > > My core question if I give a pickled file to somebody else can i guarantee > they can read/load it OK. The other person will be using exactly the same > python code to open it as used to create it. > > ==================================================================== > Prof Garry Willgoose, > Australian Professorial Fellow in Environmental Engineering, > Director, Centre for Climate Impact Management (C2IM), > School of Engineering, The University of Newcastle, > Callaghan, 2308 > Australia. > > Centre webpage: www.c2im.org.au > > Phone: (International) +61 2 4921 6050 (Tues-Fri AM); +61 2 6545 9574 (Fri > PM-Mon) > FAX: (International) +61 2 4921 6991 (Uni); +61 2 6545 9574 (personal and > Telluric) > Env. Engg. Secretary: (International) +61 2 4921 6042 > > email: garry.willgo...@newcastle.edu.au; g.willgo...@telluricresearch.com > email-for-life: garry.willgo...@alum.mit.edu > personal webpage: www.telluricresearch.com/garry > ==================================================================== > "Do not go where the path may lead, go instead where there is no path and > leave a trail" > Ralph Waldo Emerson > ==================================================================== > > > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor