Cannot pickle graph
Hi everyone, The following code snippet gives me a TypeError and I am wondering if you have any suggestion. ------------------------------------------------ import graph_tool as gt import pickle g = gt.Graph() pickle.dump(g, open('test_file', 'w’)) ------------------------------------------------ The error: TypeError: coercing to Unicode: need string or buffer, _io.BytesIO found I am working on Yosemite OS with graph_tool 2.2.35 (installed via macports). Thank you very much and happy new year!! Helen
graph.save('filename.xml') On Dec 27, 2014 9:45 PM, "Helen Lampesis" <eukolomnimonitos@gmail.com> wrote:
Hi everyone,
The following code snippet gives me a TypeError and I am wondering if you have any suggestion.
------------------------------------------------ import graph_tool as gt import pickle
g = gt.Graph() pickle.dump(g, open('test_file', 'w’)) ------------------------------------------------
The error: TypeError: coercing to Unicode: need string or buffer, _io.BytesIO found
I am working on Yosemite OS with graph_tool 2.2.35 (installed via macports).
Thank you very much and happy new year!! Helen
_______________________________________________ graph-tool mailing list graph-tool@skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool
Hi, Thanks fro the prompt reply. I might consider refactoring the code by using the graph.save function. To that end, if I save a graph in an xml format, with older versions of graph_tool (e.g., 2.32.2) is it still guaranteed that all the property maps will be stored correctly with it? With such an old version I cannot save it in the most new formats. Thanks a lot! Helen
On Dec 27, 2014, at 10:05 PM, ... <offonoffoffonoff@gmail.com> wrote:
graph.save('filename.xml')
On Dec 27, 2014 9:45 PM, "Helen Lampesis" <eukolomnimonitos@gmail.com <mailto:eukolomnimonitos@gmail.com>> wrote: Hi everyone,
The following code snippet gives me a TypeError and I am wondering if you have any suggestion.
------------------------------------------------ import graph_tool as gt import pickle
g = gt.Graph() pickle.dump(g, open('test_file', 'w’)) ------------------------------------------------
The error: TypeError: coercing to Unicode: need string or buffer, _io.BytesIO found
I am working on Yosemite OS with graph_tool 2.2.35 (installed via macports).
Thank you very much and happy new year!! Helen
_______________________________________________ graph-tool mailing list graph-tool@skewed.de <mailto:graph-tool@skewed.de> http://lists.skewed.de/mailman/listinfo/graph-tool <http://lists.skewed.de/mailman/listinfo/graph-tool>
_______________________________________________ graph-tool mailing list graph-tool@skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool
I'm sure, but can't speak authoritatively. xml is definately what you want to save it in. On Dec 28, 2014 12:29 AM, "Helen Lampesis" <eukolomnimonitos@gmail.com> wrote:
Hi,
Thanks fro the prompt reply.
I might consider refactoring the code by using the graph.save function.
To that end, if I save a graph in an xml format, with older versions of graph_tool (e.g., 2.32.2) is it still guaranteed that all the property maps will be stored correctly with it? With such an old version I cannot save it in the most new formats.
Thanks a lot! Helen
On Dec 27, 2014, at 10:05 PM, ... <offonoffoffonoff@gmail.com> wrote:
graph.save('filename.xml') On Dec 27, 2014 9:45 PM, "Helen Lampesis" <eukolomnimonitos@gmail.com> wrote:
Hi everyone,
The following code snippet gives me a TypeError and I am wondering if you have any suggestion.
------------------------------------------------ import graph_tool as gt import pickle
g = gt.Graph() pickle.dump(g, open('test_file', 'w’)) ------------------------------------------------
The error: TypeError: coercing to Unicode: need string or buffer, _io.BytesIO found
I am working on Yosemite OS with graph_tool 2.2.35 (installed via macports).
Thank you very much and happy new year!! Helen
_______________________________________________ graph-tool mailing list graph-tool@skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool
_______________________________________________ graph-tool mailing list graph-tool@skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool
_______________________________________________ graph-tool mailing list graph-tool@skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool
On 28.12.2014 21:49, ... wrote:
I'm sure, but can't speak authoritatively. xml is definately what you want to save it in.
This is true if you want backwards compatibility. But if you care only about forwards compatibility, you should also consider the 'gt' binary format, which is much faster than 'xml', and supports all property maps as well. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
On 28.12.2014 07:27, Helen Lampesis wrote:
Hi,
Thanks fro the prompt reply.
I might consider refactoring the code by using the graph.save function.
To that end, if I save a graph in an xml format, with older versions of graph_tool (e.g., 2.32.2) is it still guaranteed that all the property maps will be stored correctly with it? With such an old version I cannot save it in the most new formats.
Yes, the graphml format is backwards compatible across all versions, Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
On 28.12.2014 04:44, Helen Lampesis wrote:
Hi everyone,
The following code snippet gives me a TypeError and I am wondering if you have any suggestion.
------------------------------------------------ import graph_tool as gt import pickle
g = gt.Graph() pickle.dump(g, open('test_file', 'w’)) ------------------------------------------------
The error: TypeError: coercing to Unicode: need string or buffer, _io.BytesIO found
This is a bug in graph-tool when used with Python 2 (Python 3 is fine). It has already been fixed in git a while ago. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
participants (3)
-
... -
Helen Lampesis -
Tiago de Paula Peixoto