In [17]:
from bigbang.archive import Archive
from bigbang.archive import load as load_archive
import bigbang.graph as graph
import networkx as nx
import os
import pandas as pd

In [18]:
ietf_path = "../archives/"
# icann_path = "../archives/http:/mm.icann.org/pipermail"
# ncuc_path = "../archives/http:/lists.ncuc.org/pipermail"

paths = [os.path.join(ietf_path,"6lo.csv")]
#        os.path.join(icann_path,"wp4.csv"),
#         os.path.join(icann_path,"alac.csv"),
#         os.path.join(icann_path,"gnso-rds-pdp-wg.csv"),
#         os.path.join(icann_path,"accountability-cross-community.csv"),
#        os.path.join(icann_path,"cc-humanrights.csv"),
#        os.path.join(ncuc_path,"ncuc-discuss.csv")]

datas = [load_archive(path).data for path in paths]
         
arx = Archive(pd.concat(datas))

In [19]:
G = graph.messages_to_interaction_graph(arx.data)

In [20]:
nx.write_gexf(G,"icann_interact.gexf")


---------------------------------------------------------------------------
UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-20-8ce4f75b6ee4> in <module>()
----> 1 nx.write_gexf(G,"icann_interact.gexf")

<decorator-gen-566> in write_gexf(G, path, encoding, prettyprint, version)

/home/lem/.local/lib/python2.7/site-packages/networkx/utils/decorators.pyc in _open_file(func_to_be_decorated, *args, **kwargs)
    225         # Finally, we call the original function, making sure to close the fobj
    226         try:
--> 227             result = func_to_be_decorated(*new_args, **kwargs)
    228         finally:
    229             if close_fobj:

/home/lem/.local/lib/python2.7/site-packages/networkx/readwrite/gexf.pyc in write_gexf(G, path, encoding, prettyprint, version)
     86     writer = GEXFWriter(encoding=encoding, prettyprint=prettyprint,
     87                         version=version)
---> 88     writer.add_graph(G)
     89     writer.write(path)
     90 

/home/lem/.local/lib/python2.7/site-packages/networkx/readwrite/gexf.pyc in add_graph(self, G)
    303         self.graph_element = graph_element
    304         self.add_meta(G, graph_element)
--> 305         self.add_nodes(G, graph_element)
    306         self.add_edges(G, graph_element)
    307         self.xml.append(graph_element)

/home/lem/.local/lib/python2.7/site-packages/networkx/readwrite/gexf.pyc in add_nodes(self, G, graph_element)
    318         for node, data in G.nodes(data=True):
    319             node_data = data.copy()
--> 320             node_id = make_str(node_data.pop('id', node))
    321             kw = {'id': node_id}
    322             label = make_str(node_data.pop('label', node))

/home/lem/.local/lib/python2.7/site-packages/networkx/utils/misc.pyc in make_str(x)
    115             # unicode(3) works, but unicode(3, 'unicode-escape') wants a buffer.
    116             #
--> 117             return unicode(str(x), 'unicode-escape')
    118 else:
    119     def make_str(x):

UnicodeDecodeError: 'unicodeescape' codec can't decode byte 0x5c in position 35: \ at end of string

In [ ]: