Pickling of "graph_tool.libgraph_tool_core.Edge" instances is not enabled
Hello, I got this error when trying to save a graph to a file: Traceback (most recent call last): File "/usr/local/bin/graphanalyze.py", line 123, in <module> network.save(outFN) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/__init__.py", line 1443, in save self.__graph.WriteToFile(file_name, None, fmt, props) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/io.py", line 62, in pickler pickle.dump(obj, sstream, -1) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1370, in dump Pickler(file, protocol).dump(obj) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 224, in dump self.save(obj) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 286, in save f(self, obj) # Call unbound method with explicit self File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 600, in save_list self._batch_appends(iter(obj)) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 633, in _batch_appends save(x) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 286, in save f(self, obj) # Call unbound method with explicit self File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 548, in save_tuple save(element) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 306, in save rv = reduce(self.proto) RuntimeError: Pickling of "graph_tool.libgraph_tool_core.Edge" instances is not enabled (http://www.boost.org/libs/python/doc/v2/pickle.html) my code is: filename = basename(outputFile) + '_' + str(cutoff) + '.xml.gz' network.save(filename) -- Héctor Urbina S. Ingeniero en Bioinformática Fono: 82049138
Hi, On 06/04/2012 10:52 PM, Héctor Urbina wrote:
Hello,
I got this error when trying to save a graph to a file: [...] RuntimeError: Pickling of "graph_tool.libgraph_tool_core.Edge" instances is not enabled (http://www.boost.org/libs/python/doc/v2/pickle.html)
Edge (and Vertex) descriptors cannot be pickled. If you have property maps which store Edge or Vertex descriptors, you have to convert them to int pairs (for Edge) or int (for Vertex), and then recover them later with Graph.edge() and Graph.vertex(). Cheers, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
participants (2)
-
Héctor Urbina -
Tiago de Paula Peixoto