Archive for June 2010


ValueError: insecure string pickle

June 1st, 2010 — 7:45pm

Did you find yourself with the error saying ” insecure string pickle”  when you tried to unpickle a long pickled object?  The following is the type of traceback that you might get.

File “/usr/lib/python2.6/pickle.py”, line 1370, in load
return Unpickler(file).load()
File “/usr/lib/python2.6/pickle.py”, line 858, in load
dispatch[key](self)
File “/usr/lib/python2.6/pickle.py”, line 966, in load_string
raise ValueError, “insecure string pickle”
ValueError: insecure string pickle

Think back !! Did you pickle the object on a windows machine long back ? or did you receive the code that once pickled the object on a windows machine ? Great. One of the reasons for this error is because of the difference in newline termination by windows and linux machines.

Soluion: Use dos2unix  or fromdos commands to convert the pickled file into a unix format and then try unpickling it. !!

Comment » | Uncategorized

Back to top