Riken Shah
Riken Shah

Reputation: 3154

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

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?

Upvotes: 5

Views: 4151

Answers (1)

Mithilesh Gupta
Mithilesh Gupta

Reputation: 2930

Try:

from networkx.drawing.nx_agraph import write_dot

or

 from networkx.drawing.nx_pydot import write_dot

Upvotes: 9

Related Questions