2

I am getting this error:

AttributeError: 'list' object has no attribute 'clear'

when trying to execute the example at this page

block partition example

The example is:

>>> g = gt.collection.data["power"]
>>> bstack, mdl = gt.minimize_nested_blockmodel_dl(g, deg_corr=True)
>>> t = gt.get_hierarchy_tree(bstack)[0]
>>> tpos = pos = gt.radial_tree_layout(t, t.vertex(t.num_vertices() - 1), weighted=True)
>>> cts = gt.get_hierarchy_control_points(g, t, tpos)
>>> pos = g.own_property(tpos)
>>> b = bstack[0].vp["b"]
>>> gt.graph_draw(g, pos=pos, vertex_fill_color=b, vertex_shape=b, edge_control_points=cts,
...               edge_color=[0, 0, 0, 0.3], vertex_anchor=0, output="power_nested_mdl.pdf")
<...>

and it gives me the exception when running the line:

>>> bstack, mdl = gt.minimize_nested_blockmodel_dl(g, deg_corr=True)

Any clue?

Thanks

EdChum
  • 376,765
  • 198
  • 813
  • 562
gc5
  • 9,468
  • 24
  • 90
  • 151

1 Answers1

1

list.clear() is not in Python 2, only in Python 3. The example runs without problem in Python 3.

Anyway, graph-tool is supposed to work on Python 2.7 and above, so this might as well be reported as a bug.

jdehesa
  • 58,456
  • 7
  • 77
  • 121
  • You are right. Lately I have not the time to report the bug, I will do it as soon as I can. If somebody can.. Thanks anyway – gc5 Apr 26 '14 at 17:22
  • @unsel Can you share which OS, version of Python and version of graph-tool are you using, just to put a proper issue? I'd try to reproduce the error, but it would take me time to setup everything in Python 2 (it ain't that easy in Arch). Thanks. – jdehesa Apr 27 '14 at 17:17
  • Hi, Ubuntu `12.04`, Python `2.7.3`, graph tool version `2.2.31 (commit 245d1e2c, Thu Mar 27 11:28:39 2014 +0100)`. Sorry if I cannot help at the moment. Ask me more info in case. Thanks – gc5 Apr 27 '14 at 17:52
  • Can you please provide a full backtrace, which shows in which line the exception is raised? – Tiago Peixoto Apr 28 '14 at 16:31