mikedewar / d3py

a plottling library for python, based on D3
1.42k stars 202 forks source link

Can't run d3py_graph.py example: 'NetworkXFigure' object has no attribute 'httpd' #61

Closed ceball closed 4 years ago

ceball commented 11 years ago

I cloned d3py and tried to run the d3py_graph.py example, but ran into a problem.

$ git clone git://github.com/mikedewar/d3py.git
[...]
$ cd d3py/
$ python setup.py install
[...]
$ cd examples/
$ python d3py_graph.py 
Traceback (most recent call last):
  File "d3py_graph.py", line 15, in <module>
    with d3py.NetworkXFigure(G, width=500, height=500) as p:
  File "[...]/local/lib/python2.7/site-packages/d3py/networkx_figure.py", line 39, in __init__
    port=port, **kwargs
TypeError: __init__() takes exactly 10 arguments (9 given)
Error in clean-up: 'NetworkXFigure' object has no attribute 'httpd'

I just discovered d3py a few minutes ago, so forgive me if I've missed something. I got the demo to run like this:

$ git diff
diff --git a/examples/d3py_graph.py b/examples/d3py_graph.py
index 99c73ba..b1d9e6a 100644
--- a/examples/d3py_graph.py
+++ b/examples/d3py_graph.py
@@ -12,6 +12,6 @@ G.add_edge(3,4)
 G.add_edge(4,2)

 # use 'with' if you are writing a script and want to serve this up forever
-with d3py.NetworkXFigure(G, width=500, height=500) as p:
+with d3py.NetworkXFigure(G, width=500, height=500, host='localhost') as p:
     p += d3py.ForceLayout()
     p.show()

Unlike PandasFigure(Figure), NetworkXFigure(Figure) does not have a default host argument.

kern3020 commented 11 years ago

Hello,

@mikedewar I'll need to update and run these example to test my re-factoring for #57. If you want to assign this one to me, I can ensure it works with my pull request.

-jk

kern3020 commented 11 years ago

@ceball Just submitted a pull request which cleans this up.

happyhuman commented 11 years ago

Hi I had the same exact issue running d3py_graph.py on a Mac. I was wondering if this issue has been resolved.