unpickling

Custom instance unpickling in Python: should the object dictionary be updated, or is replacing it OK?

When defining how objects of a certain class should be unpickled, via __setstate__, I gather that it is safe to do def __setstate__(self, dict_returned_by_pickle): self.__dict__.update(dict_returned_by_pickle) when the pickled state is a dictionary. This is what I have seen in an answer here on stackoverflow. However, is this a ...

[Python] How do I read binary pickle data first, then unpickle it?

I'm unpickling a NetworkX object that's about 1GB in size on disk. Although I saved it in the binary format (using protocol 2), it is taking a very long time to unpickle this file---at least half an hour. The system I'm running on has plenty of system memory (128 GB), so that's not the bottleneck. I've read here that pickling can be spe...

[Python] How can I speed up unpickling large objects if I have plenty of RAM?

It's taking me up to an hour to read a 1-gigabyte NetworkX graph data structure using cPickle (its 1-GB when stored on disk as a binary pickle file). Note that the file quickly loads into memory. In other words, if I run: import cPickle as pickle f = open("bigNetworkXGraph.pickle","rb") binary_data = f.read() # This part doesn't take...

How to get unpickling to work with iPython?

Hello, I'm trying to load pickled objects in iPython. The error I'm getting is: AttributeError: 'FakeModule' object has no attribute 'World' Anybody know how to get it to work, or at least a workaround for loading objects in iPython in order to interactively browse them? Thanks edited to add: I have a script called world.py th...