mikedewar / d3py

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

IOError: [Errno 2] No such file or directory: 'static/d3.js' #51

Open amjith opened 11 years ago

amjith commented 11 years ago

I tried to run the sample program from README:

import d3py
import pandas
import numpy as np

# some test data
T = 100
# this is a data frame with three columns (we only use 2)
df = pandas.DataFrame({
    "time" : range(T),
    "pressure": np.random.rand(T),
    "temp" : np.random.rand(T)
})
## build up a figure, ggplot2 style
# instantiate the figure object
fig = d3py.Figure(df, name="basic_example", width=300, height=300) 
# add some red points
fig += d3py.geoms.Point(x="pressure", y="temp", fill="red")
# writes 3 files, starts up a server, then draws some beautiful points in Chrome
fig.show() 

Error:

Traceback (most recent call last):
  File "sample.py", line 15, in <module>
    fig = d3py.Figure(df, name="basic_example", width=300, height=300) 
  File "/Users/amjith/.virtualenvs/d3py/lib/python2.7/site-packages/d3py/d3py.py", line 97, in __init__
    self.filemap = {"static/d3.js":{"fd":open("static/d3.js","r"), "timestamp":time.time()},}
IOError: [Errno 2] No such file or directory: 'static/d3.js'
Error in clean-up: 'Figure' object has no attribute 'httpd'

Here's my pip freeze

d3py==0.1.0
numpy==1.6.2
pandas==0.10.0
python-dateutil==2.1
pytz==2012h
six==1.2.0
wsgiref==0.1.2
mikedewar commented 11 years ago

I think I've fixed this! Please check out the master branch, install and try again. Oh and you'll need to be using the d3py.PandasFigure instead of the straight Figure object to generate the figures. (p.s. you should now be able to use the d3py.NetworkXFigure for graphs ;-)