Hi Noel, I've pickled multi-megabyte files without problems. Did you pickle in binary or ASCII mode? Did you open the file for reading the same way? f = open('foo.foo','wb') # binary mode pickle.dump(obj, f, 1) # binary mode ... f = open('foo.foo','rb') # binary mode obj = pickle.load(f) Binary mode and ASCII mode both work fine, you just have to be consistent. -Dave > I'm trying to use pickle to serialize some of my instances to files. The > pickling operation works fine -- I do not get a pickling error, but when I > try to unpickle the file, I get the following error: > > ==== > Traceback (most recent call last): > > File "C:\perforce\blueprint\test\pickleDataTest.py", line 37, in > testCompleteRun > > x = pickle.load(file) > > File "c:\python20\lib\pickle.py", line 897, in load > > return Unpickler(file).load() > > File "c:\python20\lib\pickle.py", line 517, in load > > dispatch[key](self) > > KeyError: > ==== > > The pickle file in question is 83 KB -- is that the problem? I seem to be > having this problom on all pickle files over about 5 KB. Is there a data > format in my class that could be causing the problem? > > Thanks, > > Noel > > ------------- > Noel Rappin > Openwave > Principal Software Engineer, Internal Development > Noel.Rappin at openwave.com > (781) 274-7000 x305 > > The contents of this email message do not necessarily reflect the opinions > or programming practices of Openwave Systems > > > > > > -- > http://mail.python.org/mailman/listinfo/python-list
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4