AttributeError: 'module' object has no attribute 'write_dot' for networkx library
Asked Answered
I

1

5

I am using networkx library for reading and writing dot graphs. According to the documentation here, write_dot() method should be accessible, however when I try,

>>> import networkx
>>> networkx.write_dot(graph,fileName)

I get the following error.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'write_dot'

How can I solve this?

Infeasible answered 5/2, 2017 at 8:37 Comment(0)
T
9

Try:

from networkx.drawing.nx_agraph import write_dot

or

 from networkx.drawing.nx_pydot import write_dot
Tessellation answered 5/2, 2017 at 8:40 Comment(1)
For later versions like for version 2 following might work - networkx.nx_pydot.write_dot(graph,fileName)Kendra

© 2022 - 2024 — McMap. All rights reserved.