python 2.7 - TypeError: 'NoneType' object does not support item assignment -


i trying parse graphml file following code

and getting following error.

would please me in solving this?

note: it's first time encounter pygraphml.

the problem seems logical error in graph definition file (test.graphml). on top of pygraphml2.0, doesn't seem handle such errors:

as pointed out, error: typeerror: 'nonetype' object not support item assignment, comes graphml_parser.py line 114:

e[attr.getattribute("key")] = attr.firstchild.data 

e is/should be object of type pygraphml.edge.edge, , initialized in same file @ line 110:

e = g.add_edge_by_label(source, dest) 

the problem e none, , hence error. g (that instantiates e) object of type pygraphml.graph.graph. going graph.py, add_edge_by_label defined @ line 147:

def add_edge_by_label(self, label1, label2):     """     """      n1 = none     n2 = none      n in self._nodes:         if n['label'] == label1:             n1 = n         if n['label'] == label2:             n2 = n      if n1 , n2:         return self.add_edge(n1, n2)     else:         return 

so, you're hitting last return statement, meaning in test.graphml have (at least) 1 edge has 1 label (or maybe both), doesn't belong of graph's nodes.

obviously there's problem (i consider bug) pygraphml, if graph.add_edge_by_label can return none, none test should performed graphmlparser.parse (possibly elsewhere well).

hth (if doesn't, send me graph file have @ it).


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -