Bugs item #1724366, was opened at 2007-05-23 13:42 Message generated for change (Comment added) made by gagenellina You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1724366&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: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Geoffrey Bache (gjb1002) Assigned to: Nobody/Anonymous (nobody) Summary: cPickle module doesn't work with universal line endings Initial Comment: On UNIX, I cannot read pickle files created on Windows using the cPickle module, even if I open the file with universal line endings. It works fine with the pickle module but is of course slower (and I have to read lots of them) I attach a test case that pickles and unpickles an smptlib.SMTP object, converting the file to DOS format in between. There is nothing special about SMTP, you can use any object at all in a different module. On my system (RHEL4 with Python 2.4.3) I get the following output: portmoller : pickletest.py cPickle unix2dos: converting file dump to DOS format ... Traceback (most recent call last): File "pickletest.py", line 14, in ? print load(readFile) ImportError: No module named smtplib portmoller : pickletest.py pickle unix2dos: converting file dump to DOS format ... <smtplib.SMTP instance at 0xb7ea350c> ---------------------------------------------------------------------- Comment By: Gabriel Genellina (gagenellina) Date: 2007-05-25 06:00 Message: Logged In: YES user_id=479790 Originator: NO Please try again with this modified version. I think you will see that Python is trying to import "smtplib\r" On Windows, trying to read a pickle file with MAC line endings gives a different error: cPickle.UnpicklingError: pickle data was truncated It seems that cPickle support for protocol 0 is broken. If you can, try to use the higher, binary, protocols, they don't have this problem. Even if you must use protocol 0, opening the file always in binary mode should not have this problem. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1724366&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com