On 12.08.2016 16:58, Evangelos Petsalis wrote:
Hi,
After processing an external text file I create a an object that among other things holds a graph object, properties, vertices etc etc. I would like to save the original copy of the object, so after I can always refer back to it in a speedy fashion without having to re-parse the text file and re-initialize the object, but when I tried to use deepcopy() it complains. I can not even perform a deep copy on a Vertex object.
Any idea why this is happening, and most importantly is there a work around? (I tried pickle and shelve and they do not work either).
It is difficult to be precise, since you have not given a concrete example. But the only general issue I can see is that Vertex and Edge objects are not pickable. You should instead store their integer and pair representations, respectively: v = int(v) e = (int(e.source()), int(e.target())) and pickle that. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>